View previous topic :: View next topic
|
Author |
Message |
aripallig
New User
Joined: 05 Jul 2005 Posts: 23 Location: india
|
|
|
|
Hi,
What error will come when the MAIN PROGRAM HAVE TWO VARIABLES DEFINED AND THE SUB PROGRAMHAVE THREE VARIABLES.
Thanks,
Girish |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
Number of variable shouldnt cause any issue as long as the total data passed b/w main and sub program is of same size. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
What error will come when the MAIN PROGRAM HAVE TWO VARIABLES DEFINED AND THE SUB PROGRAMHAVE THREE VARIABLES
|
main program have two variables defined ......... what?/where? as part of working-storage, as parms of the call instruction?
and the sub program have three variables ........ as linkage items, as working-storage, as parms of call instr????
calling program has CALL using parms.
called program has Procedure Division using parms
calling parms can be working storage or linkage items
called parms must be 01/77 levels in linkage.
there is a one to one relationship between 'call using' and 'procedure division using'. If the procedure division using parms do not match to the call using parms, you will get SOC1s & 4's. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
In order to pass intelligence to a given sub-program, such as, only passing certain parameters, prefix the parmlist with a "parm map" -
Code: |
03 WS-PARM-LIST.
05 WS-PARM-MAP PIC X(256).
05 WS-PARM-001 PIC X(WHATEVER).
05 WS-PARM-002 PIC X(WHATEVER).
05 WS-PARM-003 PIC X(WHATEVER).
05 WS-PARM-004 PIC X(WHATEVER).
05 WS-PARM-005 PIC X(WHATEVER).
03 WS-SUBPGM PIC X(008) VALUE 'MYSUBPGM'.
MOVE SPACES TO WS-PARM-MAP.
MOVE 'Y' TO WS-PARM-MAP (2:1).
MOVE 'Y' TO WS-PARM-MAP (5:1).
CALL WS-SUBPGM USING WS-PARM-LIST.
|
In this example, you are informing the calling program that you are only passing PARM-002 and PARM-005. All other parms are < not present > .
The called sub-program must have the same definitions in LINKAGE and must test the presence or non-presence of a given parameter.
HTH....
Regards,
Bill |
|
Back to top |
|
|
|