Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 11:- Library Facility and sub-programming


Types of call

  • When any modification is made in sub-program, it needs to be recompiled.
  • In such case, need of recompilation of calling program (main program) is decided based on compiler option used
  • Depending on the compiler option used to compile program, the calls to sub-program are categorized into two types:-
    • Static call
    • Dynamic call

Static call

  • When calling program (main program) is compiled using NODYNAM compiler option (default), recompilation of calling program is needed to accommodate any modification of sub-program
  • Calls made in such configurations is referred to as static calls.
  • This kind of call occupies more memory as one executable load contains both calling and called program

Dynamic call

  • When calling program (main program) is compiled using DYNAM or NODLL compiler option, recompilation of calling program is not needed to accommodate the modifications of sub-program
  • This is because the modified sub-program will be in effect during the run
  • Calls made in such configuration are referred to as Dynamic call
  • Since called program is loaded from load library during run-time, it occupies less memory

Difference between Static call and Dynamic call

Static call Dynamic call
When sub-program is modified, sub-program and all its calling (main) program needs to be recompiled When sub-program is modified, only sub-program needs to be recompiled
Sub-programs are link-edited(merged) with calling program during compilation of calling program Sub-program and calling programs are compiled and link-edited separately. Sub-program will be picked from load library during run time
NODYNAM compiler option is used (By default) DYNAM or NODLL compiler option is used
You can identify call as static if CALL is coded like:-

CALL ‘SUBPGM’.

Here, SUBPGM is literal (value).
You can identify call as Dynamic, if call s coded like:-

01 MODULE-1 PIC X(8) VALUE ‘SUBPGM’. CALL MODULE-1.

Here, MODULE-1 is identifier.
Since one execution load contains both calling and called programs, it occupies more memory Since called program is loaded from load library during run time, it occupies less memory
Sub-program will not be in initial state the next time it is called, unless you explicitly use INITIAL or you do a CANCEL after each call. Program will be in initial state every time it is called
Fast, less flexible Slow compared to static call. However, its more flexible
Preferred when program functionality does not involve frequent changes Preferred when program functionality involves frequent changes






© copyright mainframebug.com
Privacy Policy