The character constant specifies character strings, such as error messages, identifiers, or other text, that the assembler converts into binary representations.
The type extension specifies the character encoding; "E" for EBCDIC encoding, "A" for ASCII encoding, and "U" for Unicode UTF-16 encoding. For example, with EBCDIC encoding the character A assembles to hexadecimal C1; with ASCII encoding the character A assembles to hexadecimal 41, with UTF-8 encoding the character A assembles to hexadecimal 0041. When the type extension is omitted, the TRANSLATE option (see High Level Assembler Programmer's Guide) specifies the character encoding. The TRANSLATE option defaults to EBCDIC. 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.
DC CL3''
is
assembled as three EBCDIC spaces with object code X'404040',
whereas DC CAL3''
is
assembled as three ASCII spaces with object code X'202020'. DC C'A,B'
is
assembled as A,B with object code X'C16BC2'. http://www.ibm.com/software/globalization/g11n-res.html
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).
Subfield | Value | Example | Result |
---|---|---|---|
1. Duplication factor | Allowed | ||
2. Type | C | ||
3. Type Extension |
U |
|
|
4. Program type | Allowed | ||
5. Modifiers | |||
Length: |
1 to 256 |
||
Implicit length: |
Evaluate as an even |
|
|
Alignment: |
Byte | ||
Scale: |
Not allowed | ||
Exponent: |
Not allowed | ||
6. Nominal value | |||
|
|
|
Object code |
Enclosed by: |
Apostrophes | ||
Exponent allowed: |
No (is interpreted as character data) | ||
Number of values |
|
|
Object code |
Padding: |
With spaces at right (X'40' EBCDIC, X'20' ASCII) | ||
Truncation of |
|
FIELD DC C'TOTAL IS 110'
FIELD DC CL15'TOTAL IS 110'
FIELD DC C'TOTAL IS &&10'
FIELD DC 3CL4'ABCDE'
ABCDABCDABCD
MVC AREA(12),=3CL4'ABCDE'
ABCDE ABCDE ABCDE (with one trailing space)