80-Bus News |
September–October 1983, Volume 2, Issue 5 |
|
|
|
Page 17 of 67 |
|
|
|
---|
To Read and then Write a Random file the steps are as follows :
e.g.
Line 110 | – | OPEN’s the file, declares it as RANDOM, and describes it as File £1 until it is closed. The name of the Data file to be known as File £1 is RADIOLOG.DAT and it uses Records of 70 bytes. |
Line 120 | – | Sets up the FIELDS for file £1. Each Field is given a Variable name and its length is set. |
Line 140 | – | GET’s each Record in turn from the Disk until the search either succeeds or fails altogether. |
Line 150 | – | Looks for match between INPUT data and Disk record data. (N.B. in this simplified example, Line 150 will probably fail to work since “G30CB” does NOT equal “G30CB “. To work correctly, the trailing blanks would have to be removed, or the INPUT callsign padded out to 8 characters with blanks. |
Line 160 | – | Continues looping until record found, or all done. |
Line 170 | – | Prints appropriate message. |
Line 180 | – | CLOSEs the file. |
Although it is possible to use the Data in the Fields directly, as in line 150 above, it is normal practice to ‘move’ the Data out of the Field variable into some other variable for processing. There are several reasons for this:–
|
|
|
Page 17 of 67 |
|
|
|
---|