User Tools

Site Tools


ibm:vm370-lib:cmshelp:assign.helpexc

ASSIGN

EXEC Interpreter

assign.helpexc.txt
ASSIGNMENT STATEMENT                                             EXEC statement

Use the assignment statement in an EXEC procedure to assign a value to a
variable symbol.  Variable symbols may be tested and manipulated to control the
execution of an EXEC procedure.  The format of the assignment statement is:
+-----------------------------------------------------------------------------+
| &variable = string                                                          |
|             ae                                                              |
|             function                                                        |
|             X'xxxxxx                                                        |
+-----------------------------------------------------------------------------+
where:

&variable
         indicates the variable symbol that is assigned the specified value.  A
         variable may contain a maximum of eight alphameric characters,
         including the initial ampersand, which is required.  Except in the
         EXEC special variables &* and &DISK*, a variable must not contain any
         special characters.

string   is a data item of up to eight characters.  It may also be a variable
         symbol or null.  Whether a numeric string is treated as numeric or
         character data depends on how it is used in the EXEC.  If a string
         containing variable symbols expands to more than eight characters, it
         is truncated.  If the string consists of eight X'FF' characters, the
         variable is set to a null string.

ae       is an arithmetic expression consisting of a sequence of data items
         that possess positive or negative integral values and are separated by
         +, -, *, or /.  For example:
            &1 - 4 + &CALC * 6

function is an EXEC built-in function followed by at least one token.

X'xxxxxx indicates up to six hexadecimal digits to be converted to decimal
         before assignment.  For example:
            &A = X'C0
         results in &A having the decimal value 192.  Hexadecimal conversion is
         not performed unless you have used the &HEX ON control statement.


Variable Substitution

All variable symbols occurring in executable statements are substituted before
the statement is executed.  An executable statement is (1) a CMS command line,
or (2) an EXEC control statement (including assignment statements).

Variable substitution is performed on all symbols on the left-hand side of an
assignment statement, except the leftmost variable.  For example:
   &I = 2
   &X&I = 5
sets &X2 to 5.

If a variable on the left-hand side of an assignment statement has already been
assigned a value, it is replaced by the new value specified in the assignment
statement.

If the special form, X'&symbol, is used, the specified symbol is converted to
its hexadecimal equivalent.  For example:
   &A = 192
   &TYPE X'&A
results in the display:
   C0

If a variable symbol that has not been defined is used in an executable
statement the symbol is set to a null token and ignored.  In some instances
this may cause an EXEC processing error.

Tokens

All executable statements in an EXEC are scanned into eight-character tokens,
and padded or truncated as necessary.  Tokens are formed of words delimited by
blanks and parentheses.  If there is no blank before or after a parenthesis,
one is added in either case.  If more than one blank separates a word or a
parenthesis from another, the extra blanks are removed from the line.  For
example, the line:
   &TYPE  THIS IS AN EXAGGERATED (MESSAGE
scans as:
   &TYPE THIS IS AN EXAGGERA ( MESSAGE

Variable symbols are substituted after each line is scanned, and each token is
scanned repeatedly until all symbols in it are substituted.

In an executable statement, a token beginning with the character X'FF' (or a
variable to which such a token is assigned as a value) usually prevents the
processing of data following it on the same line.  However, if an assignment
statement sets a variable to eight X'FF' characters, data following the
variable in an executable statement is processed.
ibm/vm370-lib/cmshelp/assign.helpexc.txt ยท Last modified: 2023/08/06 13:36 by Site Administrator