Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Processing files in ASCII or in ISO 7-bit code

COBOL2000 supports the processing of sequential files in ASCII or ISO 7-bit code by means of the following clauses (see “COBOL2000 Reference Manual” [1]):

  • ALPHABET alphabet-name-1 IS STANDARD-1(for ASCII code) or
    ALPHABET alphabet-name-1 IS STANDARD-2 (for ISO 7-bit code)
    in the SPECIAL-NAMES paragraph of the Configuration Section and

  • CODE-SET IS alphabet-name-1 in the file description entry of the File Section.

ASCII code

The following program skeleton indicates the phrases that must be entered in the COBOL compilation unit in order to process a file in ASCII code.

IDENTIFICATION DIVISION.
...
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
...
SPECIAL-NAMES.
...
   ALPHABET alphabetname-1 IS STANDARD-1 ——————————————————————————(1)
    ...
DATA DIVISION.
FILE SECTION.
FD file
   CODE-SET IS alphabetname-1 —————————————————————————————————————(2)
    ...

(1)

The ALPHABET clause links code type STANDARD-1 (i.e. ASCII code) to the name alphabet-name-1.

(2)

The CODE-SET clause specifies the code type connected with alphabet-name-1 as the character set for the file.

ISO 7-bit code

The declarations to be made in the compilation unit for the processing of a file in ISO 7-bit code are similar to those specified for the ASCII code above.
The only difference is that the keyword entered in the ALPHABET clause must be STANDARD-2 instead of STANDARD-1.
For magnetic tape files in ISO 7-bit code there is a further alternative (see also section "Processing magnetic tape files"): namely, to specify SUPPORT=TAPE(CODE=ISO7) for the file assignment in the ADD-FILE-LINK command.