Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1200
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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us