Scor­pio News

  

January–March 1987 – Volume 1. Issue 1.

Page 18 of 63

Field descriptors can be mixed in a format statement if a particular mode of I/O is required. Thus if a record such as a batch identifier and number, followed by various parameters is to be read or written, the associated format statement could look like this:

FORMAT(A4,2X,I3,​2X,3F6.3)

This looks complicated but means that a letter batch identifier and 3 digit batch number are followed by details of 3 parameters expressed as floating point numbers, the batch i/d and serial numbers are separates by 2 spaces as are the serial number and parameters. The output would appear as?:

¯LOT¯¯123¯¯23.34517.27011.555

This looks a bit messy and the parameters should be spaced out; this can be done simply by amending part of the format description to include spaces:

either – (A4,2X,I3,​2X,F6.3,​2X,F6.3,​2X,F6.3)

which works but is untidy

or – (A4,2X,I3,​3(2X,F6.3))

which also works but is better programming practice!

The effect of the change is as follows:

¯LOT¯¯123¯¯23.345¯¯17.270¯¯11.555

The overall effect is to carry out the reading or printing of 3 sets of similar combined fields and it should be noted that combinations of field descriptors used in this way should be enclosed in round brackets.

Control Statements

These guide the flow of the program and are of ten types (some of which are identical to their BASIC equivalence)

1. GO TO2. IF3. STOP4. ASSIGN5. DO
6. CONTINUE7. CALL8. PAUSE9. RETURN10. END

GO TO statements

These may be unconditional (e.g. GOTO 100 which transfers control ta another part of the program just as in BASIC), computed (e.g. GOTO (80,90,100,123) K, Where K is an integer variable such that if K has a value of 3, then control is passed to the statement label which is third in the list – in this case, 100). Note that if the value of K is 0 or greater than the number of statement numbers in the list (4 in this case), then control passes to the next logical statement in the program sequence

Assigned GO TO statements are not often used and the ASSIGN statement label(s) must be declared before they are used in this way – thus:

ASSIGN 100 TO MILKensures that in an assigned GOTO of the form
GOTO MILKcontrol is only passed to statement number 100

More than one ASSIGN statement can be used so that if:

ASSIGN 212 TO MILKthe next assigned GOTO which mentions the variable MILK will Look like:
GOTO MILK,(100,212)and control will be passed to whichever statement number corresponds with the current value of the variable MILK.
Page 18 of 63