The PROGRAM-ID paragraph specifies the name by which the program is known and assigns selected program attributes to that program. It is required and must be the first paragraph in the identification division.
If program-name is an alphanumeric literal, the literal can be up to 160 characters in length. The literal cannot be a figurative constant.
Only the hyphen, digit, and alphabetic characters are allowed in the name.
At least one character must be alphabetic.
The hyphen cannot be used as the first or last character.
The name can be up to 160 characters in length. The literal cannot be a figurative constant.
Wherever alphabetic characters are allowed, you can use multibyte characters.
For information about the PGMNAME compiler option and how the compiler processes the names, see the COBOL for Windows Programming Guide.
You can specify the RECURSIVE clause only on the outermost program of a compilation unit. Recursive programs cannot contain nested subprograms.
If the RECURSIVE clause is specified, program-name can be recursively reentered while a previous invocation is still active. If the RECURSIVE clause is not specified, an active program cannot be recursively reentered.
The working-storage section of a recursive program defines storage that is statically allocated and initialized on the first entry to a program and is available in a last-used state to any of the recursive invocations.
The local-storage section of a recursive program (as well as a nonrecursive program) defines storage that is automatically allocated, initialized, and deallocated on a per-invocation basis.
Internal file connectors that correspond to an FD in the file section of a recursive program are statically allocated. The status of internal file connectors is part of the last-used state of a program that persists across invocations.
The following language elements are not supported in a recursive program:
Methods are always recursive by default. The RECURSIVE clause cannot be specified in the METHOD-ID paragraph.
A program is in the initial state:
When a program is in the initial state, the following occur:
For the rules governing nonunique program names, see Rules for program-names.