Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Character constant—C HLASM Language Reference SC26-4940-06 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The character constant specifies character strings, such as error messages, identifiers, or other text, that the assembler converts into binary representations. If no type extension is provided, then the constant might be changed, depending on the value of the TRANSLATE option. If the type extension of "E" is provided, then the representation is also EBCDIC, but it cannot be changed by the TRANSLATE option. For information about type extension "A" see ASCII data in character constants, and for information about type extension "U" see Unicode UTF-16 data from character constants. Any of the 256 characters from the EBCDIC character set can be designated in a character constant. Each character specified in the nominal value subfield is assembled into one byte (see 1 in Table 1). For more information, see the discussion about the 82 invariant characters in Character self-defining term. A null nominal value is permitted if a length is specified. For
example:
is
assembled as three EBCDIC spaces with object code X'404040',
whereas
is
assembled as three ASCII spaces with object code X'202020'.Multiple nominal values are not allowed because a comma in the
nominal value is considered a valid character (see 2 in Table 1) and is assembled into its binary (EBCDIC)
representation (see Standard character set code table). For
example:
is
assembled as A,B with object code X'C16BC2'.Give special consideration to representing apostrophes and ampersands as characters. Each apostrophe or ampersand you want as a character in the constant must be represented by a pair of apostrophes or ampersands. Each pair of apostrophes is assembled as one apostrophe, and each pair of ampersands is assembled as one ampersand (see 3 in Table 1).
In the following example, the length attribute of FIELD is
12:
However, in this next example, the length attribute is 15, and
three spaces appear in storage to the right of the zero:
In the next example, the length attribute of FIELD is
12, although 13 characters appear in the operand. The two ampersands
are paired, and so count as only one byte.
In the next example, a length of 4 has been specified, but there
are five characters in the constant.
The generated constant is:
The same constant can be specified as a literal.
On the other hand, if the length modifier is specified as 6 instead
of 4, the generated constant is:
|
Copyright IBM Corporation 1990, 2014
|