section to describe data items before and after scanning. CMS Command and Macro Reference, which contains the descrIptIons of--the-ixic -control-statements, uses this
well. Therefore, as you create your EXEC procedures, you
the items that you enter on an EXEC statement as tokens,
how they are used by the EXEC interpreter. Variables The VMLJ1.Q formats and
convention as may think of
since that is
To make the best use of the CMS EXEC facilities, you should have an
understanding of how the EXEC interpreter performs substitutions on
variable symbols contained in tokens. Some examples follow. For each example, the input lines are shown as they would appear in an EXEC file
and as they would appear after being interpreted and executed by EXEC. Notes concerning substitution follow each example. Most of the EXEC examples in this publication
contain variable symbols that result in one-for-one substitution. Most of your variables, too, will have a similar relationship.
Lines SX-;-123 &TIPE &X After Substitution SX-;-123---------- &TIPE 123
The EXEC interpreter accepts the variable symbol &X and assigns it the
value 123. In the second statement, &X is substituted with this value,
and the control statement &TIPE is recognized and executed.
Lines SY--;-456 &Z = &Y After Substitution Sy-;-456---------- &z = 456
The symbol &Y is assigned a value of 456. In the second statement, the
symbol &I is substituted with this value, and this value is assigned to
&z. SUBSCRIPTS FOR VARIABLES: Since each token is scanned more than once for aipersands,-you-can-sIiulate subscripts by using two variable values in
the same token.
Lines S'-;-ALPHA &2 = BETA &INDEXl = 1 &TIPE &&INDEXl &INDEXl = 2 &TIPE &&INDEXl After Substitution &'-;-ALPHi-------- &2 = BETA &INDEXl = 1 &TIPE ALPHA &INDEXl = 2 &TIPE BETA
In the statement &TIPE &&INDEX1, the token &INDEX1 is scanned the first time, and the value &INDEXl is substituted with the value 1. The token
now contains &1, which is substituted with the value ALPHA on a second
scan. When the value of &INDEX1 is changed to 2, the value of &&INDEXl also changes. &1 = 2 &X&I = 5 &1 = 1 &X&I = 2 &X = &X&I + &X&X&I After Substitution &1-;-2------------ &X2 = 5 &1 = 1 &Xl = 2 &X = 2 + 5
268 IBM VM/310 CMS User's Guide
In the statement &X&I = 5, analysis of the first token
substitution of the symbol &1 with the value of 2. The
assigned a value of 5.
results in the
symbol &X2 is
The value of &1 is changed to 1, and the symbol &X1 is assigned a
value of 2.
In the last statement, &1 = &1&1 + &X&X&I, the value of &1 in the
token &X&I is replaced with 1, then the symbol &X1 is substituted with
its value, which is 2. The token &X&X&I is substituted after each of three scans: &1 is replaced with the value 1, to yield the token &X&X1. The symbol &11 has the value of 2, so the token is reduced to &X2, which
has a value of 5. COftPOUND VARIABLE Variable symbols may also be combined with character-strIngs. &X = BEE &TYPE HONEY&X &TYPE ABUftBLE&X &1 = BEE &TYPE HONEYBEE &TYPE ABUMBLE In the above example, the first symbol encountered in the scan of HONEY&I is &1, which is substituted with the value &BEE. In the second &TYPE statement, the I is truncated when the line is scanned; the symbol & is an undefined symbol and is therefore set to blanks= &X = HONEY &Y = BEE c_lTIvn'C' U.L.J...c.a.;, U'AU.L 2y£§!ityti£1! &1 = HONEY &Y = BEE &TIPE In above exampie, after the symbol substituted with the value BEE, the token contains the symbol &IBEE, which is an undefined symbol,
so the symbol is discarded.
Lines &123 = ABCDE &X = 12345678 &TYPE ABLE&&I
After Substitution &123-=-iBCDE------ &X = 12345678 &TYPE ABLEABCD
In this example, the substitution of &1 in the token ABLE&&X results in
the character string ABLE&12345678, which is truncated to eight
characters, or ABLE&123. The scan continues, and &123 is substituted
with the appropriate value, to result in ABCDE. The token is again
truncated to eight characters. You might want an ampersand to appear in a
token. You can use the &LITERAL built-in function to suppress the
substitution of variable symbols in a token. &9 = HELLO &A = &LITERAL &9 &TYPE &A
After Substitution &9-;-HELLO-------- &A = &LITERAL &9 &TYPE &9
Because the value of &A was defined as a literal &9, no substitution is
performed. &TYPE = QUERY &TYPE BLIP &TYPE = QUERY QUERY BLIP In the above example, even though &TYPE is an EXEC keyword, it is
assigned the value of QUERY, and substitution is performed when it Section 14. Building EXEC Procedures 269
Previous Page Next Page