IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Regarding static and dynamic call.


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Wed Oct 11, 2006 11:06 am
Reply with quote

can anyone pls tell me exactly wats static call and dynamic call.

static call the called program cannot be changed
dynamic call the called program can be changed

apart from this pls explain me.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Oct 11, 2006 11:22 am
Reply with quote

Hi There,

The Difference :

The main difference between static and dynamic call is the time at which the load module of a subroutine gets invoked or gets attached to the load module of its main program. To get a better picture, let us take an example.

Let A be the Main Program, and this main program invokes the subroutines X, Y and Z. We would have coded the modules X, Y, Z and would have compiled it before executing A.


Static Call:

Now, a static call to the modules X, Y and Z means attaching the load modules of X, Y, Z to the load module of A. It?s like creating a single pack which contains all the load modules needed to execute a higher level program which calls many other programs. This can be done by specifying the compiler option "NODYAM" while compiling the program.

All the load modules of sub routines are embedded within the load module of the main progam.


Dynamic Call:

A dynamic call to the modules X,Y and Z means that you will not attach the load modules of X,Y, Z to the load module of A. The load modules of X,Y and Z will lie in a separate library and the load module of A will lie in a separate library. You will just refer to the library in which the load modules of X,Y and Z lie, while executing the program A. So when ever the subroutines X or Y or Z are invoked in the program A, the library which is specified will be searched for the load modules. By mistake, if the library of the subroutine does not contain the referred program, the system standard library will be searched. If the program is not found in standard library too, the programs will abend. This can be done by specifying the compiler option "DYNAM" while compiling the program.

Performance Comparison of Static Call and Dynamic Call:
Both Static call and Dynamic Call are advantageous depending on various parameters.
1) If your subroutines involve frequent changes, then static call will be a burden. Since the load module of the subroutine is embedded inside the load module of the main program, when ever you recompile the subroutine, you should relink(Process of replacing the old load module with new one) the main program. This surely will be a burden.
In dynamic call, it?s enough if you recompile the sub-routine and put it in the specified library. The new load module will be invoked automatically from the library specified.
2) On the other hand, statically called programs take less time to execute. The overload of searching the library and then invoking the required load is not present in case of static calls.
So, depending on our application need both static calls and dynamic calls are advantageous
Back to top
View user's profile Send private message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Wed Oct 11, 2006 12:36 pm
Reply with quote

Loads of thanks to u man,I have asked to many people and now getting a clear idea of it.

is there any difference in coding (in cobol pgm)

as we can call in the procedure division as well as in the working storage section.

jose.jeyan
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Wed Oct 11, 2006 12:41 pm
Reply with quote

JOSE,

While coding in you calling program,

For a Dynamic Call:
In working storage:
77 WS-DYNAMIC-ROUTINE PIC X(08) VALUE 'XXXXXXX'.
CALL WS-DYNAMIC-ROUTINE USING LINK-VARIABLES.

For a static Call:
CALL 'XXXXXX' USING LINK-VARIABLES.


~Vamsi
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Wed Oct 11, 2006 3:16 pm
Reply with quote

Hi,

I think Static and Dynamic calls are not based on how you written your call statement.
This will be set with compiler options.
If compiler option "dynam" is on then call will be dynamic otherwise call will be static.
Back to top
View user's profile Send private message
bonniem

New User


Joined: 09 Aug 2005
Posts: 67

PostPosted: Wed Oct 11, 2006 5:37 pm
Reply with quote

What surya said is right if the call is "CALL 'XXXXXX' USING LINK-VARIABLES."

In this case it depends on the compiler option.

If call is like
77 WS-DYNAMIC-ROUTINE PIC X(08) VALUE 'XXXXXXX'.
CALL WS-DYNAMIC-ROUTINE USING LINK-VARIABLES.

then it is dynamic, whatever the compiler option.
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Thu Oct 12, 2006 4:32 pm
Reply with quote

Hi,


Static or Dynamic call is depends only on Compiler option.
If Compiler option set to "NODYNAM" then it is Static Call else "DYNAM" then it is Dynamic call.

There is no dependency on moving called program name to WS-working variable or using called program name directly in CALL staement.
Back to top
View user's profile Send private message
zaq2wsx

New User


Joined: 16 Oct 2006
Posts: 3

PostPosted: Tue Oct 17, 2006 11:05 am
Reply with quote

you mentioned compile option above is for the calling program or the called program? I guess it is for the calling program. Do we need to specify the compile option for the called program? And where we specify the library which hold the dynamically called modules?
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Wed Oct 18, 2006 11:15 am
Reply with quote

Hi,

Your guess is correct. In Calling program we need to mention compiler option, no need in Called program.

Quote:

And where we specify the library which hold the dynamically called modules?

Can you explain clearly.
Back to top
View user's profile Send private message
zaq2wsx

New User


Joined: 16 Oct 2006
Posts: 3

PostPosted: Wed Oct 18, 2006 3:39 pm
Reply with quote

So when ever the subroutines X or Y or Z are invoked in the program A, the library which is specified will be searched for the load modules. By mistake, if the library of the subroutine does not contain the referred program, the system standard library will be searched. If the program is not found in standard library too, the programs will abend. This can be done by specifying the compiler option "DYNAM" while compiling the program.

For example, I want load module of subprogram X in library ABC.LOAD, how to do that? And if the load module X is in library ABC.LOAD, where to specify the library when run program A? In the JCL of program A? how to specify? Are there examples? Thanks in advance!
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Oct 18, 2006 4:31 pm
Reply with quote

Hi zaq2wsx,

U can specify ur load library in compiled jcl of sub pgm X like
//LKED.SYSLIB DD DSN=MVS.COB2LIB,DISP=SHR
// DD DSN=ABC.LOAD,DISP=SHR
// DD DSN=SUBLIB,DISP=SHR
// DD DSN=IMS2.SUBLIB,DISP=SHR
// DD DSN=X1.TELON.LOAD,DISP=SHR
// DD DSN=SYS1.DSNDB2S.SDSNLOAD,DISP=SHR

& In main program compiled jcl u can specify load lib of X in

//LKED.SYSLMOD DD DSN=ABC.LOAD,DISP=SHR


Correction r welcome
Back to top
View user's profile Send private message
zaq2wsx

New User


Joined: 16 Oct 2006
Posts: 3

PostPosted: Thu Oct 19, 2006 7:57 am
Reply with quote

Thank you very much!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts Call program, directly from panel CLIST & REXX 9
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
Search our Forums:

Back to Top