PGMNAME

The PGMNAME option controls the handling of program-names and entry-point names.

PGMNAME option syntax

Read syntax diagramSkip visual syntax diagramPGMNAME(COMPATLONGMIXEDLONGUPPER)

Default is: PGMNAME(COMPAT)

Abbreviations are: PGMN(LM|LU|CO)

LONGUPPER can be abbreviated as UPPER, LU, or U. LONGMIXED can be abbreviated as MIXED, LM, or M.

PGMNAME controls the handling of names used in the following contexts:
  • Program-names defined in the PROGRAM-ID paragraph
  • Program entry-point names in the ENTRY statement
  • Program-name references in:
    • CALL statements that reference nested programs, statically linked programs, or DLLs
    • SET procedure-pointer or function-pointer statements that reference statically linked programs or DLLs
    • CANCEL statements that reference nested programs

PGMNAME(COMPAT)

With PGMNAME(COMPAT), program-names are handled in a manner compatible with older versions of COBOL compilers:

  • The program-name can be up to 30 characters in length.
  • All the characters used in the name must be alphabetic, digits, the hyphen, or the underscore, except that if the program-name is a literal and is in the outermost program, then the literal can also contain the extension characters @, #, and $, and the first character can be an underscore.
  • At least one character must be alphabetic.
  • The hyphen cannot be used as the first or last character.

External program-names are processed by the compiler as follows:

  • They are folded to uppercase.
  • They are truncated to eight characters.
  • Hyphens are translated to zero (0).
  • If the first character is not alphabetic, and is not an underscore, it is converted as follows:
    • 1-9 are translated to A-I.
    • Anything else is translated to J.

PGMNAME(LONGUPPER)

With PGMNAME(LONGUPPER), program-names that are specified in the PROGRAM-ID paragraph as COBOL user-defined words must follow the normal COBOL rules for forming a user-defined word:

  • The program-name can be up to 30 characters in length.
  • All the characters used in the name must be alphabetic, digits, the hyphen, or the underscore.
  • At least one character must be alphabetic.
  • The hyphen cannot be used as the first or last character.
  • The underscore cannot be used as the first character.

When a program-name is specified as a literal, in either a definition or a reference, then:

  • The program-name can be up to 160 characters in length.
  • All the characters used in the name must be alphabetic, digits, the hyphen, or the underscore.
  • At least one character must be alphabetic.
  • The hyphen cannot be used as the first or last character.
  • The underscore can be used in any position.

External program-names are processed by the compiler as follows:

  • They are folded to uppercase.
  • Hyphens are translated to zero (0).
  • If the first character is not alphabetic, and is not an underscore, it is converted as follows:
    • 1-9 are translated to A-I.
    • Anything else is translated to J.

Names of nested programs are folded to uppercase by the compiler but otherwise are processed as is, without truncation or translation.

PGMNAME(LONGMIXED)

With PGMNAME(LONGMIXED), program-names are processed as is, without truncation, translation, or folding to uppercase.

Start of changeIf you want to use a PROGRAM-ID that is longer than eight characters, enclose it in single quotation marks or apostrophes (') and use PGMNAME(LONGMIXED).End of change

With PGMNAME(LONGMIXED), all program-name definitions must be specified using the literal format of the program-name in the PROGRAM-ID paragraph or ENTRY statement. The literal user for a program-name can contain any character in the range X'41'-X'FE'.

Usage notes

  • The following elements are not affected by the PGMNAME option:
    • Class-names and method-names.
    • System-names (assignment-names in SELECT . . . ASSIGN, and text-names or library-names in COPY statements).
    • Dynamic calls.

      Dynamic calls are resolved with truncation of the program-name to eight characters, folding to uppercase, and translation of embedded hyphens or a leading digit.

    • CANCEL of nonnested programs. Name resolution uses the same mechanism as for a dynamic call.
  • Link-edit considerations: COBOL programs that are compiled with the PGMNAME(LONGUPPER) or PGMNAME(LONGMIXED) option must be link-edited in AMODE 31.
  • Dynamic calls are not permitted to COBOL programs compiled with the PGMNAME(LONGMIXED) or PGMNAME(LONGUPPER) options unless the program-name is less than or equal to 8 bytes, and all uppercase. In addition, the name of the program must be identical to the name of the module that contains it.
  • When using the extended character set supported by PGMNAME(LONGMIXED), be sure to use names that conform to the binder (linkage-editor) or system conventions that apply, depending on the mechanism used to resolve the names.

    Using characters such as commas or parentheses is not recommended, because these characters are used in the syntax of binder (linkage-editor) control statements.

related references  
PROGRAM-ID paragraph (Enterprise COBOL for z/OS® Language Reference)