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

Identify a CALL statement is DYNAMIC or STATIC


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
quanzhong

New User


Joined: 12 Aug 2008
Posts: 46
Location: china

PostPosted: Thu Sep 18, 2008 2:59 pm
Reply with quote

Hi
how can i identify a CALL statement is DYNCMIC or STATIC?
below are from PROGRAMMING GUIDE
Quote:

When you use a CALL literal statement in a program that is compiled using the DYNAM and the NODLL compiler options, or when you use the CALL identifier statement in a program that is compiled using the NODLL compiler option, a dynamic call occurs.


but I am still confused..
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Thu Sep 18, 2008 3:21 pm
Reply with quote

Quanz,

Quote:
how can i identify a CALL statement is DYNCMIC or STATIC?


Simple way to identify whether the call is static or dynamic is by looking at the COBOL code.

Code:
MOVE PROGRAM1 TO WS-PROGRAM
CALL WS-PROGRAM USING


The above is a dynamic call.

Code:
CALL ABC USING


Above is a static call where ABC is the program name.


But this is not true when you use different COMPILER options.
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Thu Sep 18, 2008 3:42 pm
Reply with quote

Hi Aaru,

There is typo in below code should have Literal ie "ABC".
Code:

CALL ABC USING


What aaru said is one way of predicting...

But we cann't judge the program is dynamically call or static call just by seeing application pgm

Before that;The basic concept beyond Dynamic & Static Call is

<Consider a pgm PGMA calls PGMB>

Dynamic Call - We will having diffrent load module for PGMA & PGMB
Static Call - We will having single load module for both pgm ie PGMA & PGMB

In case of Static call, If you change anything in PGMB, You have to compile PGMB then Link edit Object module of PGMB with Object Module PGMA then it will yield single load module to reflect changes.

In case of Dynamic Call, You don't need to worry about PGMA, just compile linkedit PGMB to reflect changes.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To know whether the pgm is Static or dynamic,

Do changes in PGMB, Just compile and linkedit(so you will having load module for PGMB)

And just RUN application PGMA, Since you changed in PGMB, it has to reflect changes which you made in PGMB when you execute that application Pgm ie PGMA if PGMA calls PGMB Dynamically.

If Changes is not reflected, then you can conclude that it is a Static Call

Hope you clear
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Thu Sep 18, 2008 4:17 pm
Reply with quote

Raghu,

Quote:
There is typo in below code should have Literal ie "ABC".


Thanks for bringing it to my notice icon_biggrin.gif.

It should be

Code:
CALL 'ABC' USING
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 18, 2008 4:44 pm
Reply with quote

If you employ a static CALL in CICS (IE: CALL 'ABC'), it would be wise to pass WORKING-STORAGE to be used by the statically-called program as a parameter from the CALLER to ensure re-entrancy. Of course, this is assuming that the CALLER had been access dynamically.

Even if you use PROGRAM IS INITIAL in the statically-called program and you don't pass it WS from the caller, its own WS remains as is and multiple tasks will compete for the same "Program" storage.

In a Threadsafe environment, this would be a big problem and it will burn you, sooner than later.

Regards,

Bill
Back to top
View user's profile Send private message
quanzhong

New User


Joined: 12 Aug 2008
Posts: 46
Location: china

PostPosted: Thu Sep 18, 2008 6:08 pm
Reply with quote

Hi,all

for dynamic call, is CANCEL statement necessary?
Code:

MOVE 'SUBPROG' TO PGM-NAME.
CALL PGM-NAME USING RECORD-1. (1) //* dynamic call
CANCEL PGM-NAME.

what will happen when forget CANCELL statement?
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Sep 18, 2008 6:21 pm
Reply with quote

The working storage values will be retained in the called program.
Refer this post for more details.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Fri Sep 19, 2008 6:06 pm
Reply with quote

This may help you.Refer mmwife's simple explanation.

ibmmainframes.com/viewtopic.php?t=91&highlight=static
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts How to identify the transaction categ... IMS DB/DC 3
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 Identify Program Insert DB2 7
Search our Forums:

Back to Top