COBOL: Static Vs Dynamic Call Which is Better

Static call and dynamic call which is better? The answer is it depends. Static call is faster, it takes less CPU time since load is part of main program load module.

Dynamic call is slower, it takes more CPU time since the load module is separately stored, and it takes time to join main program load module

1.Static Vs Dynamic Call differences.

Cobol Static and dynamic calls
Cobol Static and dynamic calls

2. Compiler options DYNAM and NODYNAM.

DYNAM

This option we need to give only for dynamic calls, and not for static calls.

NODYNAM

This option, we can give for both static and dynamic calls.

Example Static Call:

PROCEDURE DIVISION.
CALL "SUBPROG" USING RECORD-1.
CALL "PAYMASTR" USING RECORD-1 RECORD-2.
STOP RUN.

COBOL Search and Search-all When to Use

Explained when to use these two in your COBOL program.


Example Dynamic Call:

PROCEDURE DIVISION.
. . .
MOVE "SUBPROG" TO PGM-NAME.
CALL PGM-NAME USING RECORD-1.
CANCEL PGM-NAME.
MOVE "PAYMASTR" TO PGM-NAME.
CALL PGM-NAME USING RECORD-1 RECORD-2.
STOP RUN.
 Usage of Entry
PROCEDURE DIVISION USING PAYREC.
. . .
EXIT PROGRAM.
ENTRY "PAYMASTR" USING PAYREC PAY-CODE.  
<<<<<< This shows how one subprogram 
calls another program >>>>
    . . .
GOBACK.

References.

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.