The CODE-SET Clause

It can be specified only for files with record sequential

MF and line sequential

organization.

XOPEN 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

  1. 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.

Syntax Rules

  1. When the CODE-SET clause is specified for a file, all data in that file must be described as USAGE IS DISPLAY and any signed numeric data must be described with the SIGN IS SEPARATE clause.

    MF These restrictions do not apply.

  2. The alphabet-name clause referenced by the CODE-SET clause must not specify the literal phrase.

    MF These restrictions do not apply.

  3. MF Identifier-1 can be qualified, but must not be subscripted.
  4. MF Each identifier-1 must be a data item described in the same record description for the file, and must not itself be a record description.
  5. MF If the optional FOR phrase is specified, the CODE-SET clause specifies the character code to be used for the data items named. If the FOR phrase is not specified, the CODE-SET clause specifies the character code to be used for the whole file.
  6. The native character set is used for any file, or data item in a file, to which no CODE-SET clause applies.

General Rules

  1. MF 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 EDCDIC 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.
  2. MF 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.
  3. MF 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.