Evaluation of character expressions
The value of a character expression is the character string within the enclosing apostrophes, after the assembler carries out any substitution for variable symbols.
Character strings, including variable symbols, can be concatenated
to each other within a character expression. The resultant string
is the value of the expression.
Notes:
- Use two apostrophes to generate a single apostrophe as part of
the value of a character expression. The following statement assigns the character value
L'SYMBOL
to the SETC symbol&LENGTH
.&LENGTH SETC 'L''SYMBOL'
- A double ampersand generates a double ampersand as part of the
value of a character expression. To generate a single ampersand in
a character expression, use the substring notation; for example:
& SETC '&&'(1,1)
Note: A quoted single ampersand '&' is not a valid character string.The following statement assigns the character valueHALF&&
to the SETC symbol&AND
.
This is the only instance when the assembler does not pair ampersands to produce a single ampersand. However, if you substitute a SETC symbol with such a value into the nominal value in a DC instruction operand, or the operand of an MNOTE instruction, when the assembler processes the DC or MNOTE instruction, it pairs the ampersands and produces a single ampersand.&AND SETC 'HALF&&'
- To generate a period, two periods must be specified after a variable
symbol. For example, if
&ALPHA
has been assigned the character value AB%4
, the following statement can be used to assign the character valueAB%4.RST
to the variable symbol&GAMMA
.&GAMMA SETC '&ALPHA..RST'
- To generate a period, the variable symbol must have a period as
part of its value. For example:
&DOT SETC '.' &DELTA SETC 'A&DOT.&DOT' &DELTA has value 'A..'
- Double-byte data can appear in the character string if the assembler is invoked with the DBCS option. The double-byte data must be bracketed by the SO and SI delimiters, and the double-byte data must be valid.
- The DBCS ampersand and apostrophe are not recognized as delimiters.
- A double-byte character that contains the value of an EBCDIC ampersand or apostrophe in either byte is not recognized as a delimiter when enclosed by SO and SI.
- Duplication (replication) factors are permitted before character built-in functions.
- Releases of HLASM prior to Version 1 Release 4 permitted predefined
absolute symbols in character expressions. To
remove inconsistencies when handling character and arithmetic expressions
such usage is no longer permitted and results in message ASMA137S
if attempted. The built-in function BYTE can be used to convert a
numeric value in a character expression as shown.
RPTDS EQU X'01' &RPTC1 SETC 'SEND '.(BYTE RPTDS)