EDT statements and records can be written as @INPUT procedures to a SAM, ISAM or. POSIX file or to a library element of a permitted type (see section “File processing”).
The advantages of an @INPUT procedure (permanent availability, informative procedure name) can be combined with the benefits of @DO procedures (nesting, branches and loops, parameter settings) by dynamically creating and executing one or more @DO procedures within the @INPUT procedure. This makes use of the possibilities of L mode input with two EDT application symbols.
Structure of a @DO procedure within an @INPUT procedure
@DELETE | Delete current work file | | | ||
@... | EDT statements | | | | | | ||
@PROC | Switch to work file | | | ||
@DELETE | Delete content of | | | ||
@@... | | | | | ||
. | | > | | @DO procedure: | > | | | @INPUT procedure |
@@... | | | | | ||
@END | Exit work file | | | ||
@DO procnr | Call @DO procedure | | | ||
@... | EDT statements | | | | |
Example
The procedure is created in F mode in the work file 0
and is stored as a SAM file under the name BACKUPCOPY.INPUT
.
The @DO procedure consists of all the statements with two consecutive statement symbols separated only by blanks (@ @
- see below).
The procedure is called with @INPUT. The statements in the SAM fileBACKUPCOPY.INPUT
are processed. When this is done, the nested
@DO procedure (lines 6.00
to 16.00
, EDT-statements with more than one statement symbol @) are stored in work file 22
(see below) and executed immediately. Processing then switches to work file 22
.
When the statement @CREATE ... READ is processed, an input prompt is output. Once the file name TESTFILE is entered, a backup copy with the name TESTFILE.yymmdd.hhmmss is created.
The statements in the @INPUT procedure which have more than one application symbol have been stored in work file 22
in the form of a @DO procedure and the content before the second application symbol has been deleted.