CHAR
CHAR
affects the representation and runtime treatment of USAGE DISPLAY and USAGE
DISPLAY-1 data items.
| CHAR option syntax |
 .-NATIVE-.
>>-CHAR(-+-EBCDIC-+-)------------------------------------------><
'-S390---'
|
Default is: CHAR(NATIVE)
Abbreviations are: None
Specify
CHAR(NATIVE) to use the native character representation (the native
format) of the platform. For COBOL for Windows, the native format is defined by the code
page that is indicated by the locale in effect at run time. The code page can be
a single-byte ASCII code page or an ASCII DBCS code
page.
CHAR(EBCDIC) and CHAR(S390) are synonymous and indicate
that DISPLAY and DISPLAY-1 data items are in the character
representation of zSeries, that is, in EBCDIC.
However, DISPLAY and DISPLAY-1 data items defined with the NATIVE
phrase in the USAGE clause are not affected by the CHAR(EBCDIC)
option. They are always stored in the native format of the platform.
The CHAR(EBCDIC) compiler option has the following effects on
runtime processing:
- USAGE DISPLAY and USAGE DISPLAY-1 items:
Characters in data items that are described with USAGE DISPLAY are
treated as single-byte EBCDIC format. Characters in data items that are
described with USAGE DISPLAY-1 are treated as EBCDIC DBCS format.
(In the bullets that follow, the term EBCDIC refers to single-byte
EBCDIC format for USAGE DISPLAY and to EBCDIC DBCS format for USAGE
DISPLAY-1.)
- Data that is encoded in the native format is converted to EBCDIC
format upon ACCEPT from the terminal.
- EBCDIC data is converted to the native format upon DISPLAY to
the terminal.
- The content of alphanumeric literals and DBCS literals is converted to
EBCDIC format for assignment to data items that are encoded in EBCDIC.
See the table in the related reference about the COLLSEQ option
for the rules about the comparison of character data when the CHAR(EBCDIC)
option is in effect.
- Editing is done with EBCDIC characters.
- Padding is done with EBCDIC spaces. Group items that are used in
alphanumeric operations (such as assignments and comparisons) are padded
with single-byte EBCDIC spaces regardless of the definition of the
elementary items within the group.
- Figurative constant SPACE or SPACES used in a VALUE
clause for an assignment to, or in a relation condition with, a USAGE
DISPLAY item is treated as a single-byte EBCDIC space (that is, X'40').
- Figurative constant SPACE or SPACES used in a VALUE
clause for an assignment to, or in a relation condition with, a DISPLAY-1
item is treated as an EBCDIC DBCS space (that is, X'4040').
- Class tests are performed based on EBCDIC value ranges.
- USAGE DISPLAY items:
- The program-name in CALL identifier, CANCEL
identifier, or in a format-6 SET statement is
converted to the native format if the data item referenced by identifier
is encoded in EBCDIC.
- The file-name in the data item referenced by data-name in ASSIGN
USING data-name is converted to the native format if the
data item is encoded in EBCDIC.
- The file-name in the SORT-CONTROL special register is
converted to native format before being passed to a sort or merge
function. (SORT-CONTROL has the implicit definition USAGE
DISPLAY.)
- Zoned decimal data (numeric PICTURE clause with USAGE
DISPLAY) and display floating-point data are treated as
EBCDIC format. For example, the value of PIC S9 value “1”
is X'F1' instead of X'31'.
- Group items: Alphanumeric group items are
treated similarly to USAGE DISPLAY items. (Note that a USAGE
clause for an alphanumeric group item applies to the elementary
items within the group and not to the group itself.)
Hexadecimal literals are assumed to represent EBCDIC characters if the
literals are assigned to, or compared with, character data. For example, X'C1'
compares equal to an alphanumeric item that has the value 'A'.
Figurative constants HIGH-VALUE or HIGH-VALUES, LOW-VALUE
or LOW-VALUES, SPACE or SPACES, ZERO or ZEROS,
and QUOTE or QUOTES are treated logically as their EBCDIC
character representations for assignments to or comparisons with data items that
are encoded in EBCDIC.
In comparisons between nonnumeric DISPLAY items, the collating
sequence used is the ordinal sequence of the characters based on their binary
(hexadecimal) values as modified by an alternate collating sequence for
single-byte characters, if specified.
related tasks
Specifying the code page with a locale
related references
Appendix B. zSeries host data format considerations
COLLSEQ
|