Note : Even if your program is coded to call a program statically, the compiler can convert it to the dynamic call if system defaulted to DYNAM compiler options.
DYNAM- If we give this compiler option, we need to give only dynamic calls and no static calls in COBOL program.
NODYNAM – If we give this compiler option, we can give both static and dynamic calls in the COBOL program.
Static CALLs
In the static CALL, the COBOL program and all called programs are part of the same load module. When control is transferred, the called program already resides in storage, and a branch to it takes place. Subsequent executions of the CALL statement make the called program available in its last-used state unless the called program has the INITIAL attribute.
In Static all, a subroutine is called like:
CALL ‘A’ USING arguments
CALL statement specifies the name of the subroutine as a literal.
The compiler generates object code for this which will cause the linker to copy the object module a.obj into your executable when it is linked. So, if you modify “A” and recompile it, you must also relink all of the executables that call “A”, because the each of the executables contains its own copy of “A”.
Advantages:
be built into a single EXE file, or perhaps an EXE for your main, and a couple of DLLs for subordinate modules. This generally makes it simpler to distribute and/or upgrade your end users.
Note: A dynamic-link library (DLL) is a module that contains functions and data that can be used by another module (application or DLL).
they are bundled into your main program.
Dis-advantages:
Dynamic CALLs
In the dynamic CALL, the called COBOL subprogram is not link-edited with the main program, but is instead link-edited into a separate load module, and, at run time, is loaded only when it is called.
When a dynamic CALL statement calls a subprogram that is not resident in storage, the subprogram is loaded from secondary storage into the region or partition containing the main program and a branch to the subprogram is performed. The first dynamic call to a subprogram within a run unit obtains a fresh copy of the subprogram. Subsequent calls to the same subprogram (by either the original caller or any other subprogram within the same run unit) result in a branch to the same copy of the subprogram in its last-used state, provided the subprogram does not possess the INITIAL attribute.
When a CANCEL statement is issued for a subprogram, the storage occupied by the subprogram is freed, and a subsequent call to the subprogram functions as though it were the first call. A subprogram can also be canceled from a program other than the original called
In COBOL, the dynamic form of a subroutine call is coded like this:
SUBROUTINE-A PIC X(8) VALUE ‘A’. . . .
CALL SUBROUTINE-A USING arguments
The dynamic form of the CALL statement specifies the name of the subroutine using a variable; the variable contains the name of the subroutine to be invoked. The difference is that the name of the subroutine is found in the variable SUBROUTINEA. The compiled code will cause the operating system to load the subroutine when it is required instead of incorporating it into the executable.
Advantages:
Disadvantages:
Static or Dynamic:
Which call is better Static or Dynamic, the answer is it depends.
Static subroutines are nice, because your application can be built into a single EXE file or perhaps an EXE for your main, and a couple of DLLs for subordinate modules.
Dynamic subroutines are nice because you can manage memory differently and you can update a portion of your application by shipping a newer DLL instead of the entire application.
COBOL Blog: Click Here
IBM Reference: Click Here
A well-maintained product backlog is crucial for successful product development. It serves as a single…
Incremental value to the customer refers to the gradual delivery of small, functional parts of…
A Product Market refers to the group of potential customers who might be interested in…
The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…
The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…
Choosing the right Scrum Master Certification depends on your current experience and career goals. If…