[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
Reference Manual


Previous Contents Index

Syntax Rules

  1. In the first-literal phrase of the ALPHABET or CLASS clauses:
    • If alpha-name is in the PROGRAM COLLATING SEQUENCE clause, the ALPHABET clause cannot specify any character more than once.
    • If the ALSO or THRU phrase appears, first-literal must be one character long.
    • Numeric literals must be unsigned integers from 1 to 256.
    • If last-literal or lit is nonnumeric, it must be one character long.
    • THRU and THROUGH are equivalent.
  2. If the first-literal phrase appears, alpha-name cannot be referenced in a CODE-SET clause.
  3. The following are accessible only by ACCEPT and DISPLAY statements:
    argument-count
    argument-value
    environment-name
    environment-value

General Rules

  1. All clauses of the SPECIAL-NAMES paragraph apply to the program defining them and to all programs contained within that program.

device-name Clause

  1. The device-name clause associates a device with a user-defined word (device-name).
    On Tru64 UNIX, the device name is derived from an environment variable, if that environment variable exists. Otherwise, the defaults are as follows:
    System-Name Tru64 UNIX Environment Variable Tru64 UNIX Default File Name
    CARD-READER COBOL_CARDREADER stdin
    PAPER-TAPE-READER COBOL_PAPERTAPEREADER stdin
    CONSOLE COBOL_CONSOLE stderr
    LINE-PRINTER COBOL_LINEPRINTER stdout
    PAPER-TAPE-PUNCH COBOL_PAPERTAPEPUNCH stdout
    SYSIN COBOL_INPUT stdin
    SYSOUT COBOL_OUTPUT stdout
    SYSERR COBOL_ERROR stderr

    The input device for the ACCEPT statement is derived from COBOL_INPUT, if defined, and defaults to stdin . The output device for the DISPLAY statement is derived from COBOL_OUTPUT, if defined, and defaults to stdout . <>
    On OpenVMS, the file-name is derived from a logical name if that logical name exists. Otherwise, the defaults are as follows:
    System-Name OpenVMS
    Logical Name
    OpenVMS Default File Name
    CARD-READER COB$CARDREADER SYS$INPUT
    PAPER-TAPE-READER COB$PAPERTAPEREADER SYS$INPUT
    CONSOLE COB$CONSOLE SYS$ERROR
    LINE-PRINTER COB$LINEPRINTER SYS$OUTPUT
    PAPER-TAPE-PUNCH COB$PAPERTAPEPUNCH SYS$OUTPUT
    SYSIN (Alpha, I64) COB$INPUT SYS$INPUT
    SYSOUT (Alpha, I64) COB$OUTPUT SYS$OUTPUT
    SYSERR (Alpha, I64) COB$ERROR SYS$ERROR

    The input device for the ACCEPT statement is derived from COB$INPUT, if defined, and defaults to SYS$INPUT. The output device for the DISPLAY statement is derived from COB$OUTPUT, if defined, and defaults to SYS$OUTPUT. (See the ACCEPT and DISPLAY statements in Chapter 6, Procedure Division, and refer to the HP COBOL User Manual for more information.) <>

top-of-page-name Clause

  1. The system-name C01 refers to the first line of a logical page. Only the ADVANCING phrase of the WRITE statement can refer to the top-of-page-name equated to C01. (See the Section 6.8.43 statement in Chapter 6, Procedure Division.)

SWITCH Clause

  1. The ON STATUS (or OFF STATUS) phrase of the SWITCH clause associates the status of switch-name with a corresponding cond-name. The program uses a switch-status condition in the Procedure Division to test the switch.
    Switches can also be read from the OpenVMS logical name COB$SWITCHES or the Tru64 UNIX environment variable COBOL_SWITCHES.
    The compiler interprets SWITCH n and SWITCH-n (where n represents a number from 1 to 8) as identical clauses. For example, SWITCH 1 is equivalent to SWITCH-1.

Refer to the HP COBOL User Manual for more information on using switches.

ALPHABET Clause

  1. The ALPHABET clause relates a name to a character code set, collating sequence, or both.
    The ALPHABET clause specifies:
    • A character code set, when alpha-name is in a CODE-SET clause in the FILE-CONTROL paragraph or file description entry.
    • A collating sequence, when alpha-name is in: (1) the PROGRAM COLLATING SEQUENCE clause in the OBJECT-COMPUTER paragraph or (2) the COLLATING SEQUENCE phrase of a SORT or MERGE statement.
  2. ASCII refers to the character set defined in American National Standard X3.4-1968, "Code for Information Interchange."
  3. STANDARD-1 refers to the ASCII character set.
  4. STANDARD-2 refers to the international version of the ISO 7-bit code. It is defined in International Standard 646, "7-Bit Coded Character Set for Information Processing Interchange."
  5. NATIVE refers to the native character set. It consists of 256 characters. The lowest-valued 128 characters are the ASCII character set. The highest-valued 128 characters are reserved for later standardization and definition by Hewlett-Packard.
  6. EBCDIC refers to the EBCDIC character set or collating sequence. It is defined in Appendix B, Character Sets.
  7. The character with the highest ordinal position in the program collating sequence equals the figurative constant HIGH-VALUE, except when this figurative constant is specified as a literal in the SPECIAL-NAMES paragraph. If more than one character has the highest position, HIGH-VALUE is the last character you specify.
  8. The character with the lowest ordinal position in the program collating sequence equals the figurative constant LOW-VALUE, except when this figurative constant is specified as a literal in the SPECIAL-NAMES paragraph. If more than one character has the lowest position, LOW-VALUE is the first character you specify.

Literals in the ALPHABET Clause

  1. The value of each numeric literal specifies the ordinal number of a character in the native character set. For example, 66 refers to the ASCII character A.
  2. The value of each nonnumeric literal specifies the actual character in the native character set.
  3. If the literal contains more than one character, the compiler interprets each character from left to right. It assigns each a successive ascending position in the collating sequence or character code set.
  4. The order of appearance of literals in the ALPHABET clause specifies each character's ordinal number in ascending sequence. If the ALPHABET clause defines a character code set, the ordinal number identifies the character's relative position in the set.
  5. Any unspecified characters in the native collating sequence have higher positions in the new collating sequence than all specified characters. The relative order of the unspecified characters is the same as in the native collating sequence.
    For example, the following clauses are equivalent:


    ALPHABET XYZ IS 2 4
    
    ALPHABET XYZ IS 2 4 1 3 5 6 7
    
    ALPHABET XYZ IS 2 4 1
    

THROUGH Phrase

  1. The THROUGH phrase specifies a set of contiguous characters in the native character set. The first character is first-literal; the last character is last-literal.
  2. The compiler assigns each character in the set a successive ascending position in the collating sequence or character code set.
  3. The THROUGH phrase can specify the set of contiguous characters in either ascending or descending order. For example, "L" THRU "H" assigns successively higher numbers to L, K, J, I, and H.
  4. The ALSO phrase assigns first-literal and each lit to the same position in the collating sequence or character code set. For example, "A" ALSO "$" causes the characters A and $ to be equivalent in comparisons when the associated alpha-name is in the PROGRAM COLLATING SEQUENCE clause.

SYMBOLIC CHARACTERS Clause

  1. Each symbol-char corresponds to the char-val in the same relative position. In the following example, CARRIAGE-RET corresponds to 14 and ESCAPE to 28:


    Previous Next Contents Index