This format of the @INPUT statement starts an @INPUT procedure from a SAM or ISAM file. Format 2 is now only supported for reasons of compatibility and should no longer be used. The statements and/or records in the file are processed sequentially. For information on the structure and processing of EDT procedures, see section “EDT procedures”.
Operation | Operands | F mode, L mode |
@INPUT | file [(ver)] [lines[,...]] [:cols[,...]:] [{ RECORDS | KEY}] [ PRINT] |
file | Name of the SAM or ISAM file that is to be read and processed. The name Here, the symbolic name If the specified file does not exist or cannot be accessed as required or if the |
ver | Although this operand may be entered for the purposes of symmetry, it is |
lines | One or more line ranges that are to be processed in the ISAM or SAM file. If symbolic line numbers are specified then their values are taken over from |
cols | One or more column ranges containing the statements to be processed. |
KEY | Specifies that the first 8 characters of each line in a SAM file are to be |
RECORDS | In the case of SAM files, specifies that a line range (see |
Each line of the procedure should be logged before it is executed. In Specifying |
The @INPUT statement (format 2) must not be issued in @INPUT or in @DO procedures.
The keywords KEY
and RECORDS
are ignored in the case of ISAM files. If neither RECORDS
nor KEY
is specified then any lines
specification for a SAM file is ignored, i.e. all the lines in the file are processed.
The execution of an @INPUT procedure is aborted if the @RETURN statement or the last statement in the procedure has been processed.
In the case of ISAM files and SAM files (with the KEY
operand), the record key should always contain a valid line number and, when processing SAM files, EDT expects the records to be present in ascending order.
If the file is read without any line range specification then the record keys are simply ignored, i.e. they are not checked. In contrast, if line ranges are specified then EDT processes SAM and ISAM files differently.
In the case of ISAM files, the keys corresponding to the records which are actually read are checked. If a record contains a non-numerical key then execution of the procedure is aborted with error EDT4984
.
In the case of SAM files, records with non-numerical keys or with keywords which are smaller than the current lower range boundary are ignored. If the keyword is greater than the current upper range boundary then the record in question and all the records following it are ignored. Furthermore, in the case of SAM files, records that are shorter than 8 characters are also ignored.
If the @INPUT procedure contains records then these are inserted in the current work file in the same way data input in L mode (empty records are ignored). If the current work file is empty and has the character set *NONE
then it is assigned the character set of the file if records are inserted. If this character set is *NONE
then the work file is assigned the character set EDF03IRV
when records are inserted.
The statements or records read from the @INPUT procedure are interpreted in the character set corresponding to the specified file. If this character set is *NONE
then EDF03IRV
is used.
This character set may differ from the character set used in the current work file. Since statements always apply to the current work file and records are always inserted in the current work file it may therefore be necessary to convert literals in statements or records. If the file 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 execution of the @INPUT procedure is aborted with the error message EDT5453
. 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 execution of the @INPUT procedure is aborted 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.
Example
6. @PRINT 1.0000 @DELETE 2.0000 I AM LINE 1 3.0000 I AM THE SECOND LINE 4.0000 @PRINT 1 5.0000 @PRINT 2 6. @WRITE 'SAM-INP' KEY --------------------------------------------- (1) 6. @SAVE 'ISAM-INP' ------------------------------------------------- (2) 6. @INPUT 'SAM-INP' KEY --------------------------------------------- (3) 1.0000 I AM LINE 1 2.0000 I AM THE SECOND LINE 3. @INPUT 'ISAM-INP' 1-3,5,4 ---------------------------------------- (4) 2.0000 I AM THE SECOND LINE 1.0000 I AM LINE 1 3.
(1) | The content of the work file is written as a SAM file. When this is done, each line is prefixed by a key calculated on the basis of the current line number. |
(2) | The content of the work file is written again, but in this case as an ISAM file. |
(3) | The complete file |
(4) | Lines |