Modernization Hub

Calling Convention

Enhanced Definition

In the z/OS environment, a **calling convention** defines the standardized rules and mechanisms by which one program (the caller) invokes another program (the callee or subroutine) and passes control and data (parameters) between them. It specifies how parameters are placed, how return values are handled, and how control is transferred and returned, ensuring interoperability between program modules.

Key Characteristics

    • Parameter Passing Methods: Common methods include pass by reference (passing the address of the data), pass by value (passing a copy of the data, less common in traditional COBOL/Assembler for large data), and pass by descriptor (passing an address to a structure that describes the data, often used for variable-length strings or arrays).
    • Register Usage: Standard z/OS conventions heavily rely on General Purpose Registers (GPRs). R1 typically points to a list of parameter addresses, R13 points to the caller's save area, R14 holds the return address, and R15 holds the entry point address of the called program.
    • Save Area Linkage: A save area is a 72-byte (or larger) memory block used by a called program to save the caller's GPRs before using them, and restore them before returning. This ensures the caller's register context is preserved. R13 points to the caller's save area, and the called program establishes its own save area, linking it to the caller's.
    • Entry and Exit Linkage: The entry point of a called program typically saves the caller's registers and establishes addressability. The exit point restores the caller's registers, sets a return code (often in R15), and branches back to the caller using the address in R14.
    • Language-Specific Variations: While a general z/OS convention exists, languages like COBOL, PL/I, Assembler, and C/C++ have their own specific implementations and default parameter passing mechanisms, which must be understood when mixing languages. For example, COBOL's CALL ... USING typically implies pass by reference.

Use Cases

    • Subroutine/Subprogram Invocation: A COBOL program calling another COBOL program, an Assembler routine, or a C/C++ function to perform a specific task, such as data validation, complex calculation, or database interaction.
    • Inter-Language Communication (ILC): Facilitating communication between programs written in different languages, such as a COBOL application calling a high-performance Assembler routine for string manipulation or a C/C++ module for system-level services.
    • **CICS Program

Related Vendors

IBM

646 products

Applied Software

7 products

Related Categories

Operating System

154 products

Encryption

41 products

Files and Datasets

168 products