# 80-Bus News

## September-October 1983, Volume 2, Issue 5

19

150 INPUT “What TOWN. "sTNS

160 INPUT etc;

170 LSET CALLS=CSGN\$: LSET TOWNS=TNS ‘etc; 180 PUTS£1 , NEXTRECORD

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 DATES can often be

used directly.

NUMERIC FIELDS.

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

470 INPUT "Enter Telephone Number "; TELS

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

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: 20 DEFSNG A-H

60 FIELD£2,4 AS BBAL\$, etc 120 INPUT "Enter Bank Balance ";BAL 130 LSET BBALS=MKS\$ (BAL)

Line 20 – Defines that all numeric variables from A-H are to be treated as Single Precision.

Line 60 – Since BBAL\$ is the Field for the Bank Balance, assumed single Precision, a space of 4 bytes is set.

Line 120 = The balance is entered as a number.

Line 130 – The balance is made into a single precision string, and LSET into the Field.

This is an OCR’d version of the scanned page and likely contains recognition errors.