External Reference
Enhanced Definition
An **external reference** in the mainframe context refers to a symbolic name (such as a program name, subroutine entry point, or data item) that is referenced within a program or compilation unit but is defined in a separate, independently compiled or assembled program or module. The **linkage editor** or **loader** is responsible for resolving these references, connecting the referencing module to the referenced module to form an executable program. It is fundamental to modular programming, allowing applications to be built from multiple, reusable components.
Key Characteristics
-
- Symbolic Resolution: External references are resolved by their symbolic name, not by fixed memory addresses, allowing for flexible program linking.
- Link-Edit Time Resolution: Most commonly, external references are resolved by the linkage editor (e.g.,
IEWLon z/OS) which combines object modules into a single load module. - Run-Time Resolution (Dynamic): References can also be resolved dynamically at run-time by the loader for programs that are loaded on demand (e.g., using
CALLstatements to dynamically loaded modules). - Modular Programming Enabler: Facilitates the development of large applications by breaking them into smaller, manageable, and reusable program units.
- Language Agnostic: Applies across various programming languages used on z/OS, including COBOL, PL/I, Assembler, and C/C++.
- Entry Point Targeting: Often targets an entry point within another module, which is the specific location where execution can begin for that module.
Use Cases
-
- Calling Subroutines: A COBOL program invoking another COBOL program or an Assembler subroutine using the
CALLstatement, where the called program's entry point is an external reference. - Linking to System Services: Application programs referencing standard z/OS system services, library routines (e.g., COBOL run-time library functions like
IGZSRT), or vendor-supplied utilities. - Building Load Modules: The linkage editor combining multiple object modules (each potentially containing external references to others) into a single executable load module for deployment.
- Dynamic Program Loading: A CICS transaction program dynamically linking to another CICS program using
EXEC CICS LINK, where the target program is loaded and executed as an external reference. - Accessing Shared Data (Limited): While less common for direct data access across modules in COBOL without special constructs, it's fundamental in C/C++ for global variables defined in other compilation units.
- Calling Subroutines: A COBOL program invoking another COBOL program or an Assembler subroutine using the
Related Concepts
- Linkage Editor (
IEWL): This utility is central to resolving external references. It takes one or more object modules as input, resolves their external references against each other or against system libraries, and produces an executable load module. - Load Module: The final executable program on z/OS, which is composed of one or more object modules with all external references resolved to specific addresses or offsets within the module.
- Object Module: The output of a compiler or assembler, containing machine code and symbol tables, including definitions of its own entry points and references to external symbols. External references in an object module are placeholders that need to be filled by the linkage editor.
CALLStatement (COBOL): The primary mechanism in COBOL for invoking another program or subroutine, which is typically an external reference that the linkage editor or loader must resolve.- Entry Point: An external reference typically targets an entry point in another module, which is the designated starting point for execution within that module.
Best Practices:
Related Products
Related Vendors
Applied Software
7 products
Related Categories
Encryption
41 products
Files and Datasets
168 products