Reading Data
The file may be read using the READ command as in:
Command |
Description |
READ (1)A$ |
Causes PRO/5 to read the input on channel 1 until it encounters a field separator. See the CTL variable for a list of separators. |
READ (1)A$,B$,A,B,C |
Uses a number of variables instead of a single variable. PRO/5 "parses" the data read into the proper variables. |
READ RECORD(1,SIZ=32)A$ |
Specifies a number of characters to retrieve. The example retrieves 32 characters from channel 1 and place them into the variable A$. The SIZ= option specifies the maximum number of characters to retrieve to fill any one item in the input list. The RECORD option on the READ tells PRO/5 to ignore field terminators while retrieving characters. 0010 BEGIN Line 10 initializes the workspace by closing all OPEN channels and CLEARing the data. Lines 20 and 30 simply guarantee we get a file name from the user and that it is OPENed. Line 40 reads the first 32 bytes of the record, letting PRO/5 advance the record pointer, until it reaches an end-of-file (!ERROR=2) that transfers control to line 60, which terminates the program. |
The data read from a file may be modified on a character by character basis using the TBL= option. The translation of characters is done on the data read and not on any key provided using the KEY= option.