ANS85 

Conventions for Program-names

The program-name of a program is declared in the Program-ID paragraph of the program's Identification Division. A program-name can be referenced only by the CALL statement,

MF the CHAIN statement,

the CANCEL statement,

MF the SET statement

and the END PROGRAM header. If two programs in a run unit are identically named, at least one of those two programs must be directly or indirectly contained within a separate program which does not contain the other of those two programs.

The following rules regulate the scope of a program-name:

  1. If the program-name is that of a program which does not possess the common attribute and which is directly contained within another program, that program-name can be referenced only by statements included in that containing program

    ISO2002MFOS390 or, if the program possesses the recursive attribute, in the program itself

    .

  2. If the program-name is that of a program which does possess the common attribute and which is directly contained within another program, that program-name can be referenced only by statements included in that containing program and any programs directly or indirectly contained within that containing program

    ISO2002MFOS390 , except that the program possessing the common attribute and any programs contained within it may reference the program-name only if the program possesses the recursive attribute.

  3. If the program-name is that of a program that is not contained in another program, it can be referenced by statements included in any source element in the run unit.

For example, suppose that ProgA contains ProgB and ProgC, ProgC contains ProgD and ProgF, and ProgD contains ProgE, as shown below.


Diagram of ProgA contains ProgB and ProgC, ProgC contains ProgD and ProgF, and ProgD contains ProgE

If ProgD does not possess the COMMON attribute, then ProgD can only be referenced by the program that directly contains ProgD, that is, ProgC.

If ProgD does possess the COMMON attribute, then ProgD can be referenced by ProgC since it contains ProgD and by any programs contained in ProgC except for programs contained in ProgD, that is, by ProgF but not by ProgE. Also it cannot be referenced by ProgA or ProgB.