2.1.1.1.1 Rules for Program-Names
The following rules regulate the scope of a program-name:
- 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.
- 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, except that program
possessing the COMMON attribute and any programs contained within it.
- If the program-name is that of a program which is separately compiled,
that program-name can be referenced by statements included in any
other program in the run unit, except programs it directly or
indirectly contains.
The mechanism used to determine which program to call is as follows:
- If one of two programs having the same name as that specified in
the CALL statement is directly contained within the program that
includes the CALL statement, that program is called.
- If one of two programs having the same name as that specified in
the CALL statement possesses the COMMON attribute and is directly
contained within another program that directly or indirectly
contains the program that includes the CALL statement, that common
program is called unless the calling program is contained within
that common program.
- Otherwise, the separately compiled program is called.
The following rules apply to referencing a program-name of a program that
is contained within another program. For this discussion, we will say
that Program-A contains Program-B and Program-C, Program-C contains
Program-D and Program-F, and Program-D contains Program-E.
________________________________________
| Program-A |
| _________________________________ |
| | Program-B | |
| | | |
| | | |
| | | |
| |_________________________________| |
| |
| |
| _________________________________ |
| | Program-C | |
| | __________________________ | |
| | | Program-D | | |
| | | | | |
| | | _____________________ | | |
| | | | Program-E | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | |_____________________| | | |
| | |__________________________| | |
| | __________________________ | |
| | | Program-F | | |
| | | | | |
| | |__________________________| | |
| |_________________________________| |
|________________________________________|
If Program-D does not possess the COMMON attribute, then Program-D can
only be referenced by the program that directly contains Program-D, that
is, Program-C.
If Program-D does possess the COMMON attribute, then Program-D can be
referenced by Program-C since it contains Program-D and by any programs
contained in Program-C except for programs contained in Program-D. In
other words, if Program-D possesses the COMMON attribute, Program-D can be
referenced in Program-C and Program-F but not by statements in Program-E,
Program-A or Program-B.
© Copyright IBM Corp. 1991, 1998
IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.
Return to library:
z/OS |
z/OS.e |
TPF |
z/VSE |
z/VM |
IBM Hardware |
IBM System z Redbooks
Glossary:
IBM terminology
Publications:
How to order publications
Readers:
Download IBM Library Reader |
Download IBM Softcopy Reader |
Download Adobe® Acrobat® Reader®
Library management:
Download IBM Softcopy Librarian
Contacts:
Contact z/OS
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks
of Adobe Systems incorporated.