appears on an input line. In this example, when it
its value, the result is a command line which is
processing.
is substituted with
passed to CMS for &CONTROL = FIRST
&LITERAL &CONTROL ALL &CONTROL = FIRST &CONTROL ALL
In this example, &CONTROL is assigned a value as a variable symbol, but
when it is preceded by the built-in function &LITERAL, the substitution
is not performed, so EXEC processes it as a control statement. !HQ You can perform hexadecimal to
decimal and decimal to hexadecimal conversions in an EXEC if you use the
control statement &HEX ON. To convert hexadecimal to decimal, you must use an assignment statement, prefacing the hexadecimal value you want to
convert with the characters X' and assigning the value to a variable
symbol.
When 'HEX ON' is in effect, the following additional rules and
restrictions apply to tokens on EXEC control statements:
1 Any token, variable argument,
token with the string X' as the
referrred to as an X' token)
characters being either:
or combination which results in a
first two characters (this will be
must also result in the next six
(a) A valid decimal number, if the token is part
control which is not an assignment statement,
hexadcimal number, if the token is part of an
statement which is an assignment statement.
of an EXEC or a valid EXEC control
(b) The numbers mentioned in item 1a may be positive (no sign), or
negative, (prefixed with a minus sign (-220 or -FE». The
negative hexadecimal number is the absolute hexadecimal number prefixed with a minus sign (-F is a hexadecimal minus F, not a
minus.
(c) These numbers may
substituted froll a X' &X) be explicit (in the orginal token), or
variable or an argument (for example, (d) The rules for token length apply with '&HEX ON'. (e) The range of decimal numbers that may be contained in an X' token is -99999 to 999999. The range of hexadecimal numbers
that may be contained in an X' token is -FFFFF to FFFFFF. The above range of numbers may be extended by placing the number
to be converted in a variable or an argument and substituting
at conversion time. If this is done, the conversion is
accomplished using the variable or the argument as the number
source. The range for decimal numbers is -9999999 to 99999999,
the range for hexadecimal numbers is 5F5EOFF to -98967F.
These examples illustrate this feature: &Y = X'FFFFFF &TYPE X'&Y &Y = 5F5EOFF &X = X'&Y &y = 16777215 &TYPE FFFFFF &Y = 5F5EOFF &X = 99999999
(f) The notation X'-&X should not be used, because this will cause
unwanted truncations and conversion errors. 270 IBM VM/370 CMS User's Guide
If these restrictions are violated, a conversion error or
inconsistant conversion will result.
These statements are not valid if "HEX ON' is in effect: SHEX ON SX = X'50 CAUSES CONVERSION ERROR - See Item 1a above
This sequence results in a conversion error
contain a decimal number after the X', so
violates item 1a above.
because SX does not
the STYPE statement SHEX ON &X = &LITERAL I'ABC SY = SX STIPE &X &X = X'ABC LEGAL STATEMENT XY = 2748 LEGAL STATEMENT CAUSES CONVERSION ERROR 2. An X' token cannot appear on an EXEC statement other than an
assignment statement (for example, STIPE,SIF). 3. If an X' token appears on an assignment
decimal converS10n 1S performed before
statement E1 in the HEX EXEC Example.
statement, hexadecimal to
the token is used. See 4. The largest hexadecimal value that will be converted to decimal is 5F5EOFF, if the number is in a variable or an argument. If
explicitly defined, only the leftmost six digits will he used. See statement E2 of HEX EXEC Example.
5. A decimal number contained in a variable or an argument and referenced as such en an X' token (for example, X'&X) will not be
truncated before it is converted to a hexadecimal number. Decimal numbers 0 through 99999999 may be converted to hexadecimal if they
are first placed in a variable or an argument.
Note that the hexadecimal number typed is seven digits long.
Example: SHEX ON &X :: 99999999 STIPE X'SX SX = 99999999 STYPE 5F5EOFF The following illustrates conversions with 'SHEX ON! in effect: SCONTROL ALL
-E1 SHEX ON SNUM = X'FFFFFF STYPE BEX'SIUM = DEC SlUM -E2 SIF X'16777215 = X'SIUM SGOTO -E3 STIPE SLITERAL X'16777215 NE SLITERAL X'SNUM STIPE X'16777215 IE X'SIU8 -E3 SNUM = X'10 SY = SNUM + X'B STIPE SI X'SI -E4 SY = X'IUM SZ = SCONCAT SLITERAL X'1 X'SNUM SHEX OFF STYPE SI SZ SHEX ON STIPE SY SZ SNUM = 16777215 STYPE HEX FFFFFF
= DEC 16777215 SIF 28F5C = FFFFFF SGOTO -E3 STYPE X'167772 HE X'SNUM STYPE 28F5C HE FFFFFF SNUft :: 16 SY = 16 + 11 STYPE 27 1B S1 = 22 SZ = SCONC1T X'1 22 SEEX OFF STIPE 22 X'122 SHEX ON STIPE 22 7A Section 14. Building EXEC Procedures 271
Previous Page Next Page