## READ

PURPOSE:
To read a record from a FILE or DEVICE.
STATEMENT SYNTAX:
{stno} READ{RECORD} (unit{,ERR=} {,END=} {,DOM=} {,IND=} {,TIM=} {,KEY=} {,TBL=} {,SIZ=} ) {input var list} {IOL=}
EXAMPLE:
0120 READ(5,KEY=K4$,DOM=0140,ERR=999)*,R$,*,G
0500 READ(11,KEY=STR(R:"0000"))IOL=0510
7600 READ(X+1,KEY=A$+"1",ERR=999)A$,B$,C$,*,IOL=0900
9876 READRECORD(1,KEY=K$)A$
NOTES:
The READ command is used to read data from a file or device into the given list of variables (single variable if RECORD modifier used). If the information from a field or fields is not required, an asterisk, *, can be used in place of the variable name, and that field will be skipped.
After the READ operation has completed, the NEXT RECORD pointer is advanced automatically.
DIRECT FILE READING: Direct files may be read with or without a KEYkey. When read without a key, the record with the NEXT HIGHEST KEY will be read. When the file is read with a KEY, and the KEY is NOT FOUND, and ERROR 11 will be generated, and the NEXT RECORD pointer is set to the KEY that is the NEXT HIGHEST to the one that was not found. (The ERROR 11 can be TRAPPED by the DOM=kdom option)
SORT FILE READING: Sort files can be read with the READ command as well, but no INPUTinput VARIABLE LIST can be specified. In order to read a SORT FILE by KEY, this command must be used in conjunction with the KEYkey FUNCTION.
INDEXED FILE READING: Indexed files can be accessed by the READ command with no KEY=kkey or DOM= option. An IND= option may be used. After the operation is complete the NEXT RECORD POINTER will be advanced by 1.