Appendix B. COBOL CHARACTER SET AND RESERVED WORDS

EBCDIC CHARACTER SET

EBCDIC, which stands for Extended Binary Coded Decimal Interchange Code and is pronounced eb-ce-dick, is used to represent letters, digits, the character blank, and special characters. The chart shown in Figure B.1 illustrates, in ascending sequence, the EBCDIC collating sequence codes for letters, numbers, and the character blank. In addition, the chart shows the binary representation and hexadecimal codes used by the computer to represent EBCDIC codes.

EBCDIC codes for letters, numbers, character blank, and corresponding binary and hexadecimal codes.

Figure B.1. EBCDIC codes for letters, numbers, character blank, and corresponding binary and hexadecimal codes.

COBOL CHARACTERS

In COBOL, the primary unit of data is the character. In the COBOL/400 language, the letters of the alphabet, digits, and special characters that form the COBOL character set are represented by a subset of the EBCDIC character set. Figure B.2 shows the complete set of COBOL characters with their meanings and uses.

COBOL characters with their meanings and uses.

Figure B.2. COBOL characters with their meanings and uses.

RESERVED WORDS

COBOL/400 incorporates many enhancements that are not incorporated in the ANSI COBOL 85 Standard. Among them are extensions that aid in writing interactive workstation applications as well as support for externally described files.

With these extensions to COBOL/400, IBM introduced several reserved words that have special meaning. A reserved word is a word or character-string with a predefined meaning in a COBOL source program. A reserved word must not be used as a user-defined word or as a system-name. Reserved words can be used only as specified in the formats for a COBOL source program.

Figure B.3 contains a list of COBOL reserved words. In addition to the reserved words unique to COBOL/400, there are many reserved words in the ANSI Standard that are not used by the COBOL/400 compiler. If used, a diagnostic message will be generated. Reserved words that have special meaning or are not valid with the COBOL/400 compiler are identified in Figure B.3 with a number within parenthesis. The blank or number within parenthesis represents the following:

Blank

A COBOL/400 reserved word from the 1985 ANSI Standard.

1

A COBOL/400 reserved word that is an IBM extension to the 1985 ANSI Standard.

2

A COBOL reserved word from the 1985 ANSI Standard that is not used by the COBOL/400 compiler. These words should not be used. If used, a diagnostic message will be issued.

3

A COBOL reserved word that is not in the 1985 ANSI Standard and is not supported by the COBOL/400 compiler. If used, a diagnostic message will be issued.

4

A COBOL reserved word that is supported by the COBOL/400 compiler when *EXTACCDSP is specified in the CRTCBLPGM CL command, or when EXTACCDSP is used in the PROCESS statement.

COBOL reserved words.

Figure B.3. COBOL reserved words.

USING THE APOSTROPHE FOR ALPHANUMERIC LITERALS

When defining alphanumeric literals, iSeries Servers and the AS/400 expect the literals to be defined within quotation marks ("). The apostrophe (') can also be used in place of quotation marks. If the apostrophe is used, the compiler will generate a warning error for each alphanumeric literal defined within apostrophes. To have the COBOL/400 compiler accept the apostrophes and not produce warning errors, you should override the default compiler option with the PROCESS statement. See Appendix C for information about the PROCESS statement.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset