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

Static Call without using DYNAM option


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

Active User


Joined: 17 Nov 2009
Posts: 126
Location: India

PostPosted: Mon Mar 22, 2010 11:06 am
Reply with quote

If Program A calls B, and compiler option is NODYNAM .
Then if we want to call Program B and want to to start program B as a fresh each time [initialized valriables when calling each time the program B].
How to do that without using DYNAM option?
Please help.
Back to top
View user's profile Send private message
technut

New User


Joined: 27 Dec 2007
Posts: 73
Location: India

PostPosted: Mon Mar 22, 2010 2:38 pm
Reply with quote

Did some reading on this inside the forum and got the below info posted by Guptae.. might help..

A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL or you do a CANCEL. A dynamically called routine will always be in its initial state.

Link...
ibmmainframes.com/viewtopic.php?t=708
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Mar 22, 2010 3:19 pm
Reply with quote

Static or Dynamic calls are not related to what you want.
It just tells how and when the program is loaded into memory.
(search forum for more details)

technut is right, you can use INITIAL (in id division) or CANCEL (in procedure division).

You can also use LOCAL-STORAGE SECTION if you want to have both cases: part that is initialized each time (the L-S) and part not (the W-S).
Back to top
View user's profile Send private message
Susanta

Active User


Joined: 17 Nov 2009
Posts: 126
Location: India

PostPosted: Mon Mar 22, 2010 3:46 pm
Reply with quote

Thanks a lot Technut and Marso.
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Wed Mar 24, 2010 9:34 am
Reply with quote

From Technut post,

Quote:

A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL or you do a CANCEL. A dynamically called routine will always be in its initial state


Statically called subroutine cannot be deleted using CANCEL. From COBOL Programming guide,

Quote:

Statically called programs cannot be deleted using CANCEL, so static calls might take more main storage. If storage is a concern, think about using dynamic calls. Storage usage of calls depends on whether: v The subprogram is called only a few times. Regardless of whether it is called, a statically called program is loaded into storage; a dynamically called program is loaded only when it is called. v You subsequently delete the dynamically called subprogram with a CANCEL statement. Chapter 24. Using subprograms 441
You cannot delete a statically called program, but you can delete a dynamically called program. Using a dynamic call and then a CANCEL statement to delete the dynamically called program after it is no longer needed in the application (and not after each call to it) might require less storage than using a static call.


Also A dynamically called subroutine will not be always in its initial state.
From COBOL programming guide,

Quote:

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.
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 SCOPE PENDING option -check data DB2 2
No new posts OUTFIL with SAVE option DFSORT/ICETOOL 7
No new posts CICS vs LE: STORAGE option CICS 0
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
Search our Forums:

Back to Top