what is static or dynamic call in cobol

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
mainframe5
Active Member
Posts: 59
Joined: Tue Jul 24, 2007 7:25 pm

what is static or dynamic call in cobol

Post by mainframe5 » Wed Jul 25, 2007 7:37 pm

what is static or dynamic call in cobol .please give me a live example

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Wed Jul 25, 2007 11:09 pm

Mainframe5,



Static CALLS
*****************

CALL 'PGMNAME' USING arguments

NOTE : The called subroutine is a literal, it is called in quotes.


Dynamic CALLs
*******************

01 WS-SUBPGM PIC X(8) VALUE 'PGMNAME1'.

CALL WS-SUBPGM USING arguments

NOTE : There are lot of advantages and disadvantages of STATIC VS DYNAMIC calls.
It depends on the scenarios what we are dealing in specific.

Example:
**********

Say we have a program A which is calling a sub routine B.

Lets assume the call is STATIC , When an executable is build for PGM A
the object module of the called sub routine B also needs to be part of the
executable A. PGM A executable should be self sufficient in itself, meaning
it should have all the other called sub routines object modules clubbed with the
object module of the main pgm A ..such that the executable can run.

Lets assume the call is DYNAMIC for the same scenario as above,
When the main program A calls the subroutine B the object module of the
B will be loaded dynamically by the linker when PGM A is in execution
and a call is made to B.

Meaning the executable A is not fully self sufficient in itself for execution of the
application, it is depended on the LINKER to connect to other DLL's or object modules of called pgms.



NOTE ; Now which is the better way STATIC OR DYNAMIC ??


Preferably in COBOL it is a good idea to use DYNAMIC calls instead of STATIC calls.

The reason is when you use DYNAMIC calls and say there are some changes to the

sub-routine B ( same scenario as above) it is enough if we re-compile just the

sub-routine B, and we do not need to recompile program A or any other programs which

calls sub-routine B.

If it is a STATIC call then we need to have the entire listing of PGMS

which calls the sub-routine B and re-compile all the pgms.


But if you speak in terms of the Application Programming in other languages again its different

Things which needs to be given a thought

1) Assume you are developing a S/W for some feature in other language say VB OR JAVA
the product is shipped in the market in the form of an EXE(executable file).

Now lets think which is better an STATIC / DYNAMIC call with in the application ???


IF it is a static call u can ship ur product as one EXE

If it is a dynamic all u need to ship ur product as set of DLL's. ( for each called sub-routine)


There will be cost implications and user friendly issues ......


We can go on ...on the current TOPIC STATIC VS DYNAMIC , but the GOLDEN RULE is the decision can be
made considering the bigger picture in mind and the exact scenario we are dealing with.

As Info :

TO have more understanding you can goggle it , you can find N no of useful links with N examples.


Hope this little information helps you...

Thanks,
Veera.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Jul 25, 2007 11:28 pm

Veera,

another great post!

Though it is a few years old, this is link to an article by Jim Moore which, technically is up-to-date and discusses a few other aspects of the dynam vs static arguement.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

shivakumar
Member
Posts: 2
Joined: Wed Nov 21, 2007 9:01 pm

Post by shivakumar » Thu Nov 22, 2007 5:04 pm

HI All,

I'm new to this forum and cobol and please let me know where can i find
simple cobol 85 compiler to install on my PC winXP

Please send info to shivaneeraja@gmail.com


bye
:D

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others