Open System Testing Architecture

TOC PREV NEXT INDEX



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

See also:

File Handling Commands


OpenSTA.org
Mailing Lists
Further enquiries
Documentation feedback
CYRANO.com
TOC PREV NEXT INDEX