Call
Enhanced Definition
Key Characteristics
-
- Control Transfer: The calling program temporarily relinquishes control to the called program, which executes its logic.
- Parameter Passing: Data can be passed between the calling and called programs using parameters, typically by address (reference) or by value, enabling data exchange.
- Return Linkage: The calling program provides a return address, allowing the called program to transfer control back to the exact point of the call upon completion.
- Modularity and Reusability: Calls facilitate breaking down complex applications into smaller, manageable, and reusable modules, improving maintainability and development efficiency.
- Static vs. Dynamic Calls: Programs can be statically linked at compile/link-edit time (e.g., COBOL
CALLto a subprogram in the same load module) or dynamically loaded at runtime (e.g., COBOLCALLto an external program not in the same load module, or CICSEXEC CICS LINK).
Use Cases
-
- Invoking Subroutines: A common use is for a main program to call a utility subroutine (e.g., a date formatting routine, a validation module) that performs a specific, reusable function.
- Application Modularity: Large business applications are often structured as a series of programs that call each other to process different stages of a transaction or batch job.
- Accessing System Services: Application programs call system services, such as CICS commands (
EXEC CICS LINK,EXEC CICS XCTL), DB2 stored procedures (CALL procedure-name), or IMS calls, to interact with the respective subsystems. - Error Handling and Logging: Dedicated error handling or logging routines can be called from various points in an application to centralize these functions.
Related Concepts
The concept of a call is fundamental to program execution and modularity on z/OS. It is closely related to program linkage, where the LINK or LOAD macro (or their high-level language equivalents like COBOL CALL or CICS LINK) establishes the connection. A call typically expects a return of control to the calling program, unlike an XCTL (transfer control) in CICS which passes control permanently. The Program Entry Point defines where execution begins in a called program, and Parameter Lists are crucial for data exchange.
Best Practices:
- Clear Interface Definition: Document the parameters expected by a called program (data types, lengths, purpose) to ensure correct usage and prevent data corruption.
- Robust Error Handling: Called programs should return status codes or indicators to the calling program, allowing it to handle success, warnings, or errors appropriately.
- Efficient Parameter Passing: Pass only necessary data. For large data structures, passing by reference (address) is generally more efficient than by value.
- Manage Load Module Size: For static calls, be mindful of the overall load module size. For dynamic calls, ensure the called program is available in an appropriate
STEPLIB,JOBLIB, or LPA library.
Related Products
Related Vendors
CSI International
33 products
DTS Software
11 products
Rocket Software
184 products
IBM
646 products
Related Categories
Automation
222 products
Performance
171 products
Batch
132 products
Archive
24 products
Application - Other
11 products