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
 

 

STATIC & DYNAMIC Call in the same Program

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

New User


Joined: 13 Mar 2005
Posts: 2

PostPosted: Sun Mar 13, 2005 6:00 pm    Post subject: STATIC & DYNAMIC Call in the same Program
Reply with quote

hi,
this is naren.
i hav one cobol program from this i want to call two sub programs a & b
one dynamically and other static canu pls tell me how can i do this
Back to top
View user's profile Send private message

mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1202
Location: India

PostPosted: Sun Mar 13, 2005 8:55 pm    Post subject:
Reply with quote

Static and dynamic CALL statements can both be specified in the same program. In the Static CALL the subprogram invoked being link-edited with the main program into one load module. The Dynamic CALL statement results in the dynamic invocation of a separate load module.

When a dynamic CALL statement and a static CALL statement to the same
subprogram are issued within one program, a second copy of the subprogram is loaded into storage. Because this doesn't guarantee that the subprogram will be left in its last-used state, results may be unpredictable.

Example:

Code:
 
      IDENTIFICATION DIVISION.
      PROGRAM-ID. MAIN1.
 
      ENVIRONMENT DIVISION.
 
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      77  PGM-NAME                     PIC X(8).
      01  RECORD-2                     PIC X.
      01  RECORD-1.
          05  PAY                      PIC S9(5)V99.
          05  HOURLY-RATE       PIC S9V99.
          05  HOURS                 PIC S99V9.
 
      PROCEDURE DIVISION.
          MOVE "SUBPROG1" TO PGM-NAME.
          CALL PGM-NAME USING RECORD-1.
          CANCEL PGM-NAME.
          CALL "SUBPROG2" USING RECORD-2.
          STOP RUN.
Back to top
View user's profile Send private message
brahmanandareddy

New User


Joined: 16 Dec 2004
Posts: 44
Location: Hyderabad

PostPosted: Mon Mar 14, 2005 10:29 am    Post subject:
Reply with quote

Hi mcmillan,

Can u tell me which prog is called dynamically and which prog is called statically in the above prog...I am little bit confused.

Thank You,

Brahmananda Reddy. K.
Back to top
View user's profile Send private message
mainframemouli

New User


Joined: 01 Mar 2005
Posts: 52
Location: Mysore

PostPosted: Mon Mar 14, 2005 12:36 pm    Post subject:
Reply with quote

This is dynamic call

Quote:
CALL PGM-NAME USING RECORD-1.


This is static

Quote:
CALL "SUBPROG2" USING RECORD-2
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Mon Mar 14, 2005 2:33 pm    Post subject:
Reply with quote

it all depends upon the compiler option i guess..if you won't give any compiler option then all call will be dynamic whichever you use.Where as you can specify the static call while compiling the program. SYSLMOD contains the load module of a program. so while compiling you program if you provide the object module of both the program and then link it then it will be a static call otherwise if you link independently the load module of the called program is taken at run time then it will be dynamic call.
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 IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Need help in triggering a PL1 module ... Varungv99 IMS DB/DC 0 Fri Apr 07, 2017 10:01 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


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