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 and dynamic call distintion

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

New User


Joined: 17 May 2006
Posts: 17

PostPosted: Thu May 18, 2006 10:02 am    Post subject: static and dynamic call distintion
Reply with quote

how to differenciate between a static call program and a dynamic call program by looking at the program.
we can check through load module...but i want to know by looking at the program.
Back to top
View user's profile Send private message

muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Thu May 18, 2006 10:41 am    Post subject: Re: static and dynamic call distintion
Reply with quote

Mohanty,
If the program name is directly given in the call statement ,then it is a static call else if the program name is given through some variable in the call statement then it is dynamic call.

Correct me if i am wrong,

Regards,
Muthuvel.
Back to top
View user's profile Send private message
ursprasanna
Warnings : 2

New User


Joined: 15 May 2006
Posts: 20
Location: chennai

PostPosted: Thu May 18, 2006 2:58 pm    Post subject:
Reply with quote

Mohanthy,

the statis call and dynamic call can be differentiated from the progarm like this...

Static call : Here the subprogram will be called directly ..

example ( for static ) : call 'XYZ' using ( some arguments or parameters)

Dynamic call : here the program name is stored in a variable and after that the variable is called in the program.

example ( for dynamic ) :

01 dynamic-call pix X(??) value 'XYZ'.

call dynamic-call using ( some arguments or parameters).
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Thu May 18, 2006 6:19 pm    Post subject:
Reply with quote

You need to look at the Program code and Compile Options.

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

Please Search before posting, it would reduce the time that you have to wait before someone responds.
Back to top
View user's profile Send private message
sada_polaris

New User


Joined: 24 May 2006
Posts: 13

PostPosted: Wed May 24, 2006 4:35 pm    Post subject: Re: static and dynamic call distintion
Reply with quote

Let me explain.
Static call means the cobol load module will have the called module linkedited into the same load.
But where as in the case of dynamic call the calling program and the called program load will not depend on one another. Both will be seperately located in the library.
If we define the program name in the working storage and if we call it in the program then that is called IMPLICITE call. icon_smile.gif
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu May 25, 2006 11:35 am    Post subject: Re: static and dynamic call distintion
Reply with quote

Hi ,

i just wana know whether this IMPLICIT call is a type of dynamic call
in which the program name is stored in working storage

or IMPLICIT call is completely diferent

Thanks ,
-Kapil.
Back to top
View user's profile Send private message
gskulkarni

New User


Joined: 01 Mar 2006
Posts: 70

PostPosted: Thu May 25, 2006 11:38 am    Post subject:
Reply with quote

It is a dynamic call.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu May 25, 2006 11:46 am    Post subject: Re: static and dynamic call distintion
Reply with quote

Thanks for Clarificartion ..

-Kapil .
Back to top
View user's profile Send private message
humpty
Warnings : 1

New User


Joined: 01 May 2005
Posts: 23

PostPosted: Thu May 25, 2006 5:07 pm    Post subject:
Reply with quote

i think this will explain the dynamic and ctatic call.

Examples: static and dynamic CALL statements
This example shows how you can code static and dynamic calls.

The example has three parts:

Code that uses a static call to call a subprogram
Code that uses a dynamic call to call the same subprogram
The subprogram that is called by the two types of calls
The following example shows how you would code static calls:


PROCESS NODYNAM NODLL
IDENTIFICATION DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 RECORD-2 PIC X. (6)
01 RECORD-1. (2)
05 PAY PICTURE S9(5)V99.
05 HOURLY-RATE PICTURE S9V99.
05 HOURS PICTURE S99V9.
. . .
PROCEDURE DIVISION.
CALL "SUBPROG" USING RECORD-1. (1)
CALL "PAYMASTR" USING RECORD-1 RECORD-2. (5)
STOP RUN.
The following example shows how you would code dynamic calls:


DATA DIVISION.
WORKING-STORAGE SECTION.
77 PGM-NAME PICTURE X(8).
01 RECORD-2 PIC x. (6)
01 RECORD-1. (2)
05 PAY PICTURE S9(5)V99.
05 HOURLY-RATE PICTURE S9V99.
05 HOURS PICTURE S99V9.
. . .
PROCEDURE DIVISION.
. . .
MOVE "SUBPROG" TO PGM-NAME.
CALL PGM-NAME USING RECORD-1. (1)
CANCEL PGM-NAME.
MOVE "PAYMASTR" TO PGM-NAME. (4)
CALL PGM-NAME USING RECORD-1 RECORD-2. (5)
STOP RUN.
The following example shows a called subprogram that is called by each of the two preceding calling programs:


IDENTIFICATION DIVISION.
PROGRAM-ID. SUBPROG.
DATA DIVISION.
LINKAGE SECTION.
01 PAYREC. (2)
10 PAY PICTURE S9(5)V99.
10 HOURLY-RATE PICTURE S9V99.
10 HOURS PICTURE S99V9.
77 PAY-CODE PICTURE 9. (6)
PROCEDURE DIVISION USING PAYREC. (1)
. . .
EXIT PROGRAM. (3)
ENTRY "PAYMASTR" USING PAYREC PAY-CODE. (5)
. . .
GOBACK. (7)
(1)
Processing begins in the calling program. When the first CALL statement is executed, control is transferred to the first statement of the PROCEDURE DIVISION in SUBPROG, which is the called program.
In each of the CALL statements, the operand of the first USING option is identified as RECORD-1.

(2)
When SUBPROG receives control, the values within RECORD-1 are made available to SUBPROG; however, in SUBPROG they are referred to as PAYREC.
The PICTURE character-strings within PAYREC and PAY-CODE contain the same number of characters as RECORD-1 and RECORD-2, although the descriptions are not identical.

(3)
When processing within SUBPROG reaches the EXIT PROGRAM statement, control is returned to the calling program. Processing continues in that program until the second CALL statement is issued.
(4)
In the example of a dynamically called program, because the second CALL statement refers to another entry point within SUBPROG, a CANCEL statement is issued before the second CALL statement.
(5)
With the second CALL statement in the calling program, control is again transferred to SUBPROG, but this time processing begins at the statement following the ENTRY statement in SUBPROG.
(6)
The values within RECORD-1 are again made available to PAYREC. In addition, the value in RECORD-2 is now made available to SUBPROG through the corresponding USING operand, PAY-CODE.
When control is transferred the second time from the statically linked program, SUBPROG is made available in its last-used state (that is, if any values in SUBPROG storage were changed during the first execution, those changed values are still in effect). When control is transferred from the dynamically linked program, however, SUBPROG is made available in its initial state, because of the CANCEL statement that has been executed.

(7)
When processing reaches the GOBACK statement, control is returned to the calling program at the statement immediately after the second CALL statement.
In any given execution of the called program and either of the two calling programs, if the values within RECORD-1 are changed between the time of the first CALL and the second, the values passed at the time of the second CALL statement will be the changed, not the original, values. If you want to use the original values, you must save them.
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 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 Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm


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