EXEC Control Statements-&LOJP, &PUNCH, &READ
1. When loop execution is control passes to the next
statement following the end of the loop.
The condition is always tested before the loop is executed. LL the
specified condition is met, then the loop is not executed. For
example, the statement: &LOOP 3 &COUNT = 100 specifies that the next three lines are interpreted until the value
of &COUNT is 100.
3. LOops may be nested up to four levels deep. All nested loops may ena at the same label.
4. A loop is closed when the requirements for termination specified in tha &LOOP statement are met, or when control is transferred outside
the scope of the loop (using &GOTO or &SKIP). &PUNCH Use tha &PUNCH control statement to punch a line of tokens to the
virtual card punch. The format of the &PUNCH control statement is: r , &PUNCH L- rtok1 rtok2 ••• rtokn]]]
tok1 [tok2 ••• [tokn]]
specifies the tokens to be punched. All tokens are padded or trJncated to eight characters. The punched line is right-padded
with blanks to fill an 80-column card. If no tokens are specified,
a line consisting of 80 blank characters is punched. 1. Lines punched with the &PUNCH control statement are scanned by the EXEC interpreter and variable symbols are substituted before the
line is punched. In fixed-length EXEC files, only the first 72
characters of the record are scanned. To punch one or more lines
of unscanned data, use the &BEGPUNCH or &BEGPUN:H ALL control
statement.
2. When you have finished punching lines in an EXEC procedure, you can use the CP command CLOSE to close the spool punch file and release
it for processing.
&READ Use the &READ control statement to read one or more lines from the
terminal or console stack. The lines may contain data or executable
statements. The format of the &READ control statement is: Section 5. EXEC Control Statements 291
EXEC Control Statements-tREAD, &SKIP .-- I I &RErtD I I I I L- n 1 rtRGS r I n , 1 IrtRGS IVrtRS [&varl [&var2 ••• L
, I I I [&varn]]] , .J
1
reads the next n lines from the terminal and treats them as if
they had been in the EXEC file. Reading from the terminal
stops when n lines have been read, or when an &LOOP statement
or a statement that transfers control is encountered. If an
&READ statement is encountered, tne number of lines to be read by it is added to the number outstanding.
If n is not specified, the default 1 is assumed, and the EXEC continues processing after reading a single line.
reads a single line, assigns the entered tokens to the special
variables & 1, &2, ••• , &n, and resets the speci al variables &INDEt, &*, and &$.
If any of the tokens is specified as a percent sign (%) or
begins with the character X'FF', the corresponding argument is
set to blanks. VrtRS [&varl (&var2 ••• [&varn)]]
reads a single line and assigns the tokens entered to the
variable symbols &varl, &var2, ••• , &varn (up to 11). These variables are scanned in the same way as though they
appeared on the left-hand side of an assignment statement. If
no variable names are specified, any data read from the
terminal is lost.
If any of the tokens is specified as a percent sign (%) or
begins with the character X'FF', the corresponding variable is
set to blanks.
You can test the special variable &READFLAG to determine whether the
next &RErtD statement will result in a physical read to your terminal
(the value of &RErtDFLrtG is CONSOLE) or in reading a line from the
console stack (the value of &READFLAG is STrtCK). &SKIP Use the &SKIP control statement to cause a specified number of lines in
the EXEC file to be skipped. The format of the &SKIP control statement
is: r I r , , &SKIP , n I , , 1 I , L -' L- --I 292 IBM VM/370 CMS Command and Macro Reference
Previous Page Next Page