Modernization Hub

DYNAM - Dynamic Call

Enhanced Definition

`DYNAM` (Dynamic) is a COBOL compiler option that enables a program to call another program whose name is not known until runtime. Instead of linking the called program at compile or link-edit time, the system resolves the program's entry point during execution, providing significant flexibility in program design. `DYNAM` (Dynamic Call) is a COBOL compiler option and a programming technique in z/OS where the address of a called subprogram is resolved at **runtime** rather than at **link-edit time**. This allows a calling program to invoke external subprograms that reside in separate load modules, providing significant flexibility in application design and maintenance.

Key Characteristics

    • Runtime Resolution: The name of the called program is specified in a data item (e.g., PIC X(8)) and resolved by the z/OS operating system's program loader at the moment the CALL statement is executed.
    • CALL identifier Syntax: Implemented in COBOL using the CALL identifier statement, where identifier is a data name containing the program's entry point name.
    • Compiler Option: Requires the DYNAM compiler option to be specified during COBOL compilation. Without it, CALL identifier would typically result in a compile error or be treated as a static call to a program literally named identifier.
    • MVS Search Order: The z/OS system searches for the load module of the dynamically called program in the standard MVS search order: job pack area, STEPLIB/JOBLIB, and LINKLIST/LPA.
    • Flexibility: Allows for easier modification of program flow or integration of new modules without recompiling the calling program.
    • Performance: Generally incurs a slight performance overhead compared to static calls due to the runtime search and loading process.

Use Cases

    • Transaction Routing: A CICS transaction processing program might dynamically call different application modules based on the transaction ID or input parameters received.
    • Generic Utility Programs: A common utility program can dynamically invoke specific processing routines (e.g., different report generators or data transformation modules) based on control file entries or user input.
    • Plug-in Architectures: Implementing a modular system where new business rules or processing logic can be "plugged in" by simply updating a configuration that specifies the program name to be called.
    • Batch Job Control: A master batch program can dynamically dispatch to various sub-programs to perform different tasks based on parameters passed via JCL or an input dataset.
    • A/B Testing or Feature Toggles: Dynamically switching between different versions of a program or feature based on runtime conditions without requiring a recompile and redeploy.

Related Concepts

DYNAM is the counterpart to static calls, where the called program's name is a literal and its address is resolved during the link-edit phase. The STEPLIB, JOBLIB, and LINKLIST JCL statements and system libraries are critical for the z/OS program loader to locate the load modules of dynamically called programs. It directly influences the behavior of the COBOL CALL statement when the target is an identifier rather than a literal.

Best Practices:
  • Robust Error Handling: Always include ON EXCEPTION or check return codes after a dynamic CALL to handle scenarios where the called program is not found (resulting in an S806 abend) or encounters an error.
  • Library Management: Ensure that all potential dynamically called programs are consistently placed in accessible STEPLIB, JOBLIB, or LINKLIST libraries to prevent runtime errors.
  • Performance Analysis: For frequently executed or performance-critical calls, evaluate whether a static call would be more appropriate, as dynamic calls introduce a small overhead.
  • Clear Interface Definition: Strictly define and document the LINKAGE SECTION for parameters passed between calling and called programs to ensure data integrity and prevent mismatches.
  • Security Considerations: Exercise caution when the program name for a dynamic call is derived from external input, as this could potentially lead to the execution of unauthorized code if not properly validated.

Related Vendors

IBM

646 products

Boole and Babbage

4 products

Trax Softworks

3 products

Related Categories

Operating System

154 products

Monitor

262 products

Browse and Edit

64 products