View previous topic :: View next topic
|
Author |
Message |
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Hi Folks,
if we call one subprogram by using call statement.
is there any specific declaration required in sub program/main program.
tell me the reason for both static and dynamic calls..please. |
|
Back to top |
|
|
kanak
Moderator
Joined: 12 Mar 2005 Posts: 252 Location: India
|
|
Back to top |
|
|
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Hi kanak,
My question is different.
Am not worrying abt STATIC/DYNAMIC calls. |
|
Back to top |
|
|
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Doen we need to give any declarations in sub program and main program. |
|
Back to top |
|
|
kanak
Moderator
Joined: 12 Mar 2005 Posts: 252 Location: India
|
|
|
|
sorry babuprasad_g,
Well you are calling program statically then you don't need to give any declaration of sub program in mainline, where as in case of dynamic you need to give a declaration in workign storage section. |
|
Back to top |
|
|
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Hi kanak,
if it is static call just we use
CALL SUB-PROG
if it is dynamic call
01 WS-SUB PIC X(8).
MOVE SUB-PROG TO WS-SUB.
then we
CALL WS-SUB USING WS-SUB-VAR01,WS-SUB-VAR02.
Is it right. other than these declaration we need to give any declarations/not. |
|
Back to top |
|
|
kanak
Moderator
Joined: 12 Mar 2005 Posts: 252 Location: India
|
|
|
|
no that much is enough. One thing i would like to point out is in static call we need to give
call 'sub-prog'
where in dynamic call it is
call ws-sub-prog |
|
Back to top |
|
|
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Thank you kanak. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
I've seen these examples of pgm CALLs using hyphenates names. This is confusing to those who don't understand the CALL concept.
For example SUB-PGM looks like a data variable name not a literal. So whe someone writes CALL 'SUB-PGM' it might be confused w/a variable. The usual convention is CALL 'subpgm' or CALL 'literal'.
A fine point but worth noting. |
|
Back to top |
|
|
|