The @READ statement fully or partially reads a SAM file from disk or tape into the current work file.
Operation | Operands | F mode, L mode |
@READ | [file] [(ver)] [lines[,...] ] [:cols[,...]:] [ {RECORDS | KEY} ] [STRIP] |
file | Name of the SAM file that is to be read in. The name must correspond to If there is as yet no local @FILE entry for the work file then, if the statement If the specified file does not exist or cannot be accessed as required then If the file link name |
ver | Version number of the file that is to be read. If the specified version number |
lines | One or more line ranges that are to be read in from the SAM file. If symbolic If If |
cols | One or more column ranges which define the section to be read in from If no column range is specified then the lines are read in full. |
KEY | EDT interprets the first 8 characters of each read in record as a key. The In this case, EDT checks whether a valid key is present in the first 8 If |
RECORDS | Specifies that a line range (see If |
STRIP | Causes any blanks at the end of each generated work file line to be deleted. |
If KEY
is specified (or lines
without RECORDS
) then lines shorter than 8 characters are ignored.
If lines
or cols
is specified then line numbers or column numbers may repeat, thus resulting in the corresponding lines or columns being read in several times.
If the read operation is performed without a KEY
specification then the line numbers are assigned as a function of the current line number and current increment (see section “Line number assignment”).
The file is only opened temporarily during the read operation. If the file to be read in is empty, warning EDT2903
is output.
If the current work file is empty and has the character set *NONE
then it is assigned the character set of the file that is to be read in. If this character set is *NONE
then the work file is assigned the character set EDF03IRV
.
If the work file already has a character set then the records that are to be read in are converted from the file's character set into the work file's character set. If the file that is to be read contains characters which cannot be displayed in the work file's character set then these are replaced by a substitute character if such a character has been specified (see @PAR SUBSTITUTION-CHARACTER), otherwise file read is aborted and the error message EDT5453
is output. This also applies if there are invalid characters outside of the column range that is to be read. In contrast, invalid characters outside of the line range that is to be read are ignored.
If the file is present in a Unicode character set and contains an illegal byte sequence, e.g. surrogate characters, then it will be impossible to read it even if SUBSTITUTION-CHARACTERS
is specified. In this case, the read operation is rejected with the message EDT5454
.
If the statement is interrupted with [K2] and the EDT session is continued with /INFORM-PROGRAM
then the processing of the statement is aborted and message EDT5501
is output.
Note
If an attempt is made to use @READ to read an ISAM file then EDT issues the error message EDT1901
and sets the switch for EDT errors. It nevertheless reads the specified file by performing an internal @GET for this file.
In this case, the operands STRIP
, RECORDS
and KEY
are ignored.
If file
is specified then it is still possible, for reasons of compatibility, to abbreviate @READ to R
in F mode.