![]() |
![]() |
![]() |
![]() |
READ Command
Description:
This command reads a single record from an external file that is currently open into a variable. If the file record is longer than the variable, the record data is truncated.
The record read will be delimited by a newline character in the file. This newline character is used purely as a record delimiter and does not form part of the record.
By default, the file will be rewound when an "End-of-File" status is returned by the READ command. This action may be modified by use of the "AT END GOTO label" clause.
The file is read sequentially.
Format:
READ variable FROM fileid {AT END GOTO label} {ON ERROR GOTO err_label}Parameters:
variable
A character variable into which the next record from the file is read.
fileid
The name associated with the file when it was opened.
label
A label within the current scope of the script, to which script execution will branch if the "End-of-File" status is encountered.
err_label
A label within the current scope of the script, to which script execution will branch if an error occurs.
Examples:
READ data_record FROM datafile READ data FROM datafile AT END GOTO EXIT_LABEL & ON ERROR GOTO read_error
CYRANO Customer Support: France +33 (0) 1 56 33 40 00 USA +1 (978) 462-0737; Toll free 800-714-4900 UK +44 (0) 1274 761024 support-fr@cyrano.com support-us@cyrano.com support-uk@cyrano.com |
![]() |
![]() |
![]() |
![]() |