General Format
[ PROGRAM-ID. program-name [ IS {INITIAL } PROGRAM ] . ]
{RESIDENT}
Syntax Rule
program-name is a user-defined word or a reserved word. It must be unique among separately compiled programs. If a reserved word is used,
it is treated as if it were not reserved. The maximum number of characters is 30.
General Rules
- The
program-name identifies the name of the program. It is used by the run-time system and debugger to identify a program.
- The INITIAL clause specifies an initial program. Whenever an initial program is called, it is placed in its initial state.
Data contained in an initial program is set to its starting value every time the program is called. Note that the
-Zi compiler option causes the program to be compiled as if it had the IS INITIAL PROGRAM phrase specified.
- Files contained in the program are not in the open mode:
- The first time the program is called.
- The first time the program is called after it has been the target of a CANCEL statement.
- Every time the program is called if it is an INITIAL program.
- On all other entries, the files contained in the program are in the same state and position as when the program last exited.
- INITIAL programs are removed from memory when they exit. Non-initial programs remain in memory until they are the targets
of a CANCEL statement.
- The RESIDENT clause specifies that the program is to remain resident in memory after its first execution. A program with the
RESIDENT clause cannot be affected by a CANCEL statement. Note that the RESIDENT clause shields selected programs from the
effects of a CANCEL Statement.
- The IBM DOS/VS COBOL
-Cv compatibility mode allows the name to be enclosed in quotation marks.
- If you omit the PROGRAM-ID paragraph, the program's name is derived from the source file name as follows:
- All directory information is removed from the filename and only the base filename is used.
- If the filename includes a period (".") or space, that portion of the filename (including the period or space) is truncated.
- The name is translated to upper case for letters in the ASCII alphabet range.
- Characters not in the ASCII alphabet are left unchanged.
- If the PROGRAM-ID paragraph is omitted, the program does not have an INITIAL or RESIDENT state.