Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Difference B'ween STATIC & DYNAMIC

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
prasadrachuri

New User


Joined: 19 Aug 2003
Posts: 20
Location: kolkata

PostPosted: Fri Aug 22, 2003 12:10 pm    Post subject: Difference B'ween STATIC & DYNAMIC
Reply with quote

Hi,
Can any one explain what is the difference between a STATIC CALL and DYNAMIC CALL.when exactly a module will be said it is called as STATIC or DYNAMIC.

some one say icon_lol.gif

CALL 'PROG1' USING XXX,YYYY as STATIC
and
CALL 'WS-PROG1' USING XXX,YYYY as DYNAMIC

where WS-PROG1 is working storage variable who's value is 'PROG1'.

and some say icon_lol.gif

in order to call a module DYNAMIC one should specify DYNAM compiler option should use for program IEWL.but i couldn't found any option like this in my compiler jcl.

Thanks in Advance,
Prasad Rachuri.
Back to top
View user's profile Send private message

mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 238
Location: USA

PostPosted: Fri Aug 22, 2003 1:36 pm    Post subject:
Reply with quote

Hello prasadrachuri,

DYNAMIC CALL:

Code:
CALL <prog-name> USING <param1>


STATIC CALL:

If you are copying any PROCEDURE DIVISION copybook in your program, it is called a STATIC CALL

Code:
COPY <prog-name>


here program name is a PROCEDURE DIVISION copybook


Hope this helps you

Regards

Mayuresh Tendulkar
Back to top
View user's profile Send private message
Rajasekhar-Reddy

New User


Joined: 20 Aug 2003
Posts: 1
Location: kolkata

PostPosted: Mon Aug 25, 2003 12:22 pm    Post subject:
Reply with quote

Rajasekhar-Reddy wrote:
Hello prasad,
I think the following matter clear the difference between STATIC CALL AND DYNAMIC CALL

FORM OF CALL MODE
------------------------- --------------

CALL identifier Always dynamic

CALL literal with DYNAM Dynamic
CALL literal with NODYNAM Static


Suppose we have a calling program set up as shown below:

WORKING-STORAGE SECTION.
.
.
01 WS-SUB-PROG PIC X(8) VALUE 'SUBPROG1'.
.
.
01 WS-EMP-REC.
05 WS-EMP-NAME PIC X(20).
05 WS-EMP-ADDR PIC X(20).
05 WS-EMP-SAL PIC S9(5)V99 COMP-3.
.
.
01 WS-PROD-REC.
05 WS-PROD-TYPE PIC X.
05 WS-PROD-UNITS PIC S9(5)V99 COMP-3.
.
.
PROCEDURE DIVISION.
.
.
CALL WS-SUB-PROG USING WS-EMP-REC,
WS-PROD-REC

Since this CALL statement uses an identifier to specify the name of the
subprogram to be called, this would be a dynamic CALL. If the compiler
option NODYNAM is in effect, then a static CALL to the same subprogram
could be coded as:


CALL 'SUBPROG1' USING WS-EMP-REC
WS-PROD-REC

If any thing wrong please let me know...... icon_lol.gif
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1202
Location: India

PostPosted: Tue Aug 26, 2003 11:45 am    Post subject: Re
Reply with quote

Static programs are compiled separately but Linkedited together while dynamic modules are seperately compiled & linkedited. They are identified and loaded into memory at run time by LE or other Run time environments.
Back to top
View user's profile Send private message
prasadrachuri

New User


Joined: 19 Aug 2003
Posts: 20
Location: kolkata

PostPosted: Tue Aug 26, 2003 12:21 pm    Post subject:
Reply with quote

Hi,
Thanks for the repiles...but how can i know is my subprogram is called by STATIC or DYNAMIC by seeing the CALL statement in my program.Can i found any information in my calling program load module.

Thanks in advance,
Prasad Rachuri...
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1202
Location: India

PostPosted: Tue Aug 26, 2003 12:29 pm    Post subject: Re
Reply with quote

In your program you need to use a variable name in the call statement for dynamic calls.

ex:

ACCEPT <var1>.
CALL <var1> USING <arg>

At compile time the called program name (var1) is not known. So you need to compile this program with DYNAM option.
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Wed Jan 07, 2004 6:09 pm    Post subject: static and dynamic call differences
Reply with quote

hi prasad,
here is some information about static and dynamic calls which may help you.

Static CALLs
In COBOL, you normally call a subroutine like this:

CALL 'A' USING arguments

The static form of the CALL statement specifies the name of the subroutine as a literal; e.g., it is in quotes.

This is the static form of a subroutine call. 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".

Dynamic CALLs
In COBOL, the dynamic form of a subroutine call is coded like this:

01 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 SUBROUTINE-A. The compiled code will cause the operating system to load the subroutine when it is required instead of incorporating it into the executable..

some compilers let you set options that will override the calling mechanisms shown above. Therefore, even if your program is coded to call a program statically, the compiler can convert it to the dynamic form of CALL if you set (or don't set) the correct compiler options(i.e thru DYNAM option in jcl)


REGARDS
ANURADHA
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Jan 08, 2004 3:09 am    Post subject:
Reply with quote

I doubt that Prasad is still interested, but for posterity, this is a succinct statemet of the issue:

If compiled as NODYNAM:
CALL 'literal' is a static call
CALL WS-label is a dynamic call

If compiled as DYNAM:
CALL 'literal' is a dynamic call
CALL WS-label is a dynamic call

Regards, Jack.
Back to top
View user's profile Send private message
Arun Joseph

New User


Joined: 30 Mar 2005
Posts: 13
Location: India

PostPosted: Wed Mar 30, 2005 9:41 pm    Post subject:
Reply with quote

Just to add..
The orginal pgms load module will have the load module of a statically called pgm. But not a dynamically called pgm.
So static called pgm has to be compiled before a dynamically called pgm.
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Fri Jul 01, 2005 11:50 pm    Post subject: Re: Difference B'ween STATIC & DYNAMIC
Reply with quote

Another question related to static v/s dynamic call.

How much expensive is Dynamic calls?
If I have a choice to make it static or dynamic what should be my choice?

In short, what are merits and demerits of both static and dynamic calls?


Thank you in advance
Back to top
View user's profile Send private message
sribks2005

New User


Joined: 04 Apr 2005
Posts: 20
Location: Mysore

PostPosted: Mon Jul 04, 2005 5:48 pm    Post subject: Difference between Static and Dynamic calls
Reply with quote

hi,

If storage is of main concern, then we can go for "Dynamic call" as module will be loaded to main memory only when it is called/needed.

If speed is of main concern, then we can go for "Static Call" as all modules will be link-edited together into the calling module during compilation process only.

Correct, if any mistakes here.

Thanks
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Mon Jul 04, 2005 5:53 pm    Post subject:
Reply with quote

hi parikshit
just check this link
http://ibmmainframes.com/viewtopic.php?p=10419#10419
Back to top
View user's profile Send private message
dhirend

New User


Joined: 04 Jul 2005
Posts: 1

PostPosted: Mon Jul 04, 2005 6:39 pm    Post subject:
Reply with quote

The dynamic and static calling depends on Compiler options only.

U can check a program is calling other pgm dynamically/ statically by looking at the load module.

Suppose program XYZ is calling ABC , then the load module of XYZ in case of dynamic calling will not have any other load module.

If XYZ has a static call to ABC , in that case load module of XYZ will be having load module of ABC also attached to it. If XYZ is calling more then one programs static way , then u will find all those load modules attached in the load module of XYZ.
In case of static calling , first u will have to compile the called programs and then compile the main program.
Back to top
View user's profile Send private message
venkatesh29
Warnings : 1

New User


Joined: 04 Oct 2005
Posts: 3

PostPosted: Tue Oct 04, 2005 1:25 pm    Post subject: Thanks
Reply with quote

Hi All,

Thanks for all your answers.

Regards,
Venkatesh
Back to top
View user's profile Send private message
rakesh.in.in

New User


Joined: 01 Mar 2007
Posts: 5
Location: Pune

PostPosted: Tue Mar 13, 2007 12:48 pm    Post subject:
Reply with quote

In Static call- The called module and main module are link edited.
But in case of Dynam call- The called module and main module are exit as a separate module.
or
Use keyword Dynamic for Dynamic call
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Thu Mar 15, 2007 2:30 pm    Post subject:
Reply with quote

Hi Dhirend,

How ll you identify load module of ABC is present in load module of XYZ?
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Mon Mar 26, 2007 11:01 pm    Post subject:
Reply with quote

Where I work, 99.9% of our calls are dynamic. The performance difference between the dynamic and static calls are insignificant in the grand scheme of things.

Dynamically called programs are much more easier to manage than static programs. The extra time you would spend managing 'static' subroutines would be much better spent doing other things - such as optimizing your DB2.

As always there are exceptions to this rule. But not many. Use dynamic calls and spend your extra time making sure your designs are solid.
Back to top
View user's profile Send private message
mahesh_yellale

New User


Joined: 25 Dec 2006
Posts: 3
Location: pune

PostPosted: Wed Apr 18, 2007 1:02 pm    Post subject: Re: Difference B'ween STATIC & DYNAMIC
Reply with quote

static call
In static call the program is called by name of the progrm
e.g.
CALL "MAHESH"

and the progrm "MAHESH" is then included in the main memory and hence the main program along with the sub pgm. aretreated as a same load module in static call.
similarly as the subpgm is in main memory itincrease the main memory size and also faster to access the pgm

Dynamic call

Where in case of Dynamic call the program is called by variable e.g.

W-S-SECTION.

01 SUBPGM PIC X(6).

PROCEDURE DIVISION.

MOVE "MAHESH" TO SUBPGM.
CALL "MAHESH".

this example shows that the program has been called by the variable subpgm in which the value "MAHESH" is initialized and hence when you called pgm program it just called as a seperate load module and unlike static not included in the main memory also hence at the time of execution it takes time to search the subpgm and which in turn take more time time in compared to static call
Back to top
View user's profile Send private message
VIKAS GAIKWAD

New User


Joined: 30 Nov 2006
Posts: 33
Location: MUMBAI

PostPosted: Mon Sep 03, 2007 12:40 pm    Post subject:
Reply with quote

Hi mmwife,


Quote:
I doubt that Prasad is still interested, but for posterity, this is a succinct statemet of the issue:

If compiled as NODYNAM:
CALL 'literal' is a static call
CALL WS-label is a dynamic call



If I compiled program as NODYNAM & CALL WS-label then how & why it is get converted to Dynamic call? The option is NODYNAM then it should be static call, but finally it gets converted to Dynamic call, How it happens? Whether CALL variable overrieds NODYNAM to DYNAM or it instructs compiler to convert it into Dynamic call.


Thanks,

Vikas.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Fri Sep 28, 2007 5:22 pm    Post subject: hi.....
Reply with quote

Hi All...


This is explained in the manuals which is provided above....pls check that...


Thanks
Vasanth..... icon_lol.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us