Character constant—C
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-16 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
The type extension specifies the character encoding; "E" for EBCDIC encoding, "A" for ASCII encoding, and "U" for Unicode encoding. For example, with EBCDIC encoding the character A assembles to hexadecimal C1; with ASCII encoding the character A assembles to hexadecimal 41, with Unicode UTF-16 encoding the character A assembles to hexadecimal 0041. When the type extension is omitted, EBCDIC encoding is normally assumed, but the TRANSLATE option (see High Level Assembler Programmer's Guide) may be used to translate the data to another encoding. 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".
The CCSID in which a character constant is stored is determined by the corresponding option: CE for EBCDIC, CA for ASCII or CU for Unicode. For a normal DC constant, the current value of the option is used, taking into account any changes specified on ACONTROL statements, but for a literal (as for a self-defining term) the initial value of the option is used as at the start of the assembly. If the appropriate CE option is specified as LOCAL or matches the EBCDIC option, no translation is performed for EBCDIC constants.
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'. Subfield | Value | Example | Result | |
---|---|---|---|---|
1. | Duplication factor | Allowed | ||
2. | Type | C | ||
3. | Type Extension | U A E |
U DC CU'UNICODE' |
L'U = 14 |
4. | Program type | Allowed | ||
5. | Modifiers | |||
Length: | 1 to 256 (byte length) Must be a multiple of 2 when the Type Extension is U .1 to .2048 (bit length) (Not permitted if Type Extension of U is specified.) |
|||
Implicit length: (Length modifier not present) |
Evaluate as an even number, if Type Extension of U is specified | C DC C'LENGTH' |
L'C = 6 1 |
|
Alignment: | Byte | |||
Scale: | Not allowed | |||
Exponent: | Not allowed | |||
6. |
Nominal value Represented by: |
Characters (all 256 eight bit combinations) |
DC C'A''B' DC CU'AA'
DC CA'AB' |
Object code X'C17DC2'
3 X'00410041' X'4142' |
Enclosed by: | Apostrophes | |||
Exponent allowed: | No (is interpreted as character data) | |||
Number of values per operand: | One | DC C'A,B' |
Object code X'C16BC2' 2 |
|
Padding: | With spaces at right (X'40' EBCDIC, X'20' ASCII) | |||
Truncation of assembled value: | At right |
FIELD
is
12: FIELD DC C'TOTAL IS 110'
FIELD DC CL15'TOTAL IS 110'
FIELD
is
12, although 13 characters appear in the operand. The two ampersands
are paired, and so count as only one byte. FIELD DC C'TOTAL IS &&10'
FIELD DC 3CL4'ABCDE'
ABCDABCDABCD
MVC AREA(12),=3CL4'ABCDE'
ABCDE ABCDE ABCDE (with one trailing space)