The CODE-SET clause specifies the character code set used to represent data on the external media.
It can be specified only for files with record sequential
and line sequential
organization.
Although it is a part of the standard COBOL definition, this feature is explicitly excluded from the X/Open COBOL language
definitions and should not be used in a conforming X/Open COBOL source program.
General Format
Directives
- In addition to Compiler directives which provide flagging and modify the reserved word list, the following directive may impact
either the syntax or the semantics described in this section.
- CHARSET – determines what is considered the native code set.
General Rules
- The data in the record area is always in ASCII. If alphabet-name has been equated in the Special-Names paragraph to EBCDIC,
then data affected by the CODE-SET clause is translated from ASCII to EBCDIC as it is written to the file; or from EBCDIC
to ASCII as it is read from the file. If alphabet-name has been equated in the Special-Names paragraph to STANDARD-1, STANDARD-2,
NATIVE, or ASCII, no translation is necessary.
- For the purposes of this translation, any data item to which a CODE-SET clause applies is treated as alphanumeric. No account
is taken of the class and category of the item as described in its data description.
- If identifier-1 has an OCCURS clause, the CODE-SET clause applies to only the first occurrence of it. If identifier-1 has
a subordinate item with an OCCURS clause, the CODE-SET clause applies to the whole of identifier-1.