80-Bus News

  

September–October 1983 · Volume 2 · Issue 5

Page 19 of 67

Suppose that CSGN$="G30CB”. Then since the CALL$ Field is 8 Bytes long, the effect of 180 is to produce a LEFT justified Field “G30CB   “, i.e. 3 trailing spaces are added to ‘pad out’ the variable. It does not normally matter whether the field is LEFT or RIGHT justified as long as the same standard is used throughout the program. It is obviously essential to know how the Field is justified. In some cases such as the Date Field, there will be no padding and the length will be constant. Thus the Field DATE$ can often be used directly.

Numeric Fields.

Much of the above discussion is correct only in respect of String data. It is usually O.K. to store some types of numbers directly into strings and such numbers can be retained in this way. e.g.

Numbers to be used in calculations may also be input in this way if preferred. In fact it may be a good idea to input all data in string form as this can mean easier and better Error trapping. Note that numbers stored in this way will usually require more Disk space. Data stored in this way must however be converted to Numeric form by use of the VAL function before any calculations can be carried out.

The alternative way to store Numeric data still requires that it be LSET or RSET. Before this can be done the number must be converted into String form by the use of a special function. One of three possible choices must be made:

MKI$= Make Integer Number into a 2 byte string.
MKS$= Make Single Precision Number into 4 byte string.
MKD$= Make Double Precision Number into 8 byte string.

And typical usage:



Line 20Defines that all numeric variables from A-H are to be treated as Single Precision.
Line 60Since BBAL$ is the Field for the Bank Balance, assumed single Precision, a space of 4 bytes is set.
Line 120The balance is entered as a number.
Line 130The balance is made into a single precision string, and LSET into the Field.
Page 19 of 67