IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

More variables in Linkage section


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
aripallig

New User


Joined: 05 Jul 2005
Posts: 23
Location: india

PostPosted: Wed Feb 13, 2008 11:52 am
Reply with quote

Hi,

What error will come when the MAIN PROGRAM HAVE TWO VARIABLES DEFINED AND THE SUB PROGRAMHAVE THREE VARIABLES.
Thanks,
Girish
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Wed Feb 13, 2008 12:01 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 13, 2008 12:55 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 14, 2008 6:48 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts JCL with variables JCL & VSAM 1
No new posts FD Section to Create FB or Vb File Dy... COBOL Programming 1
No new posts JCL Variables JCL & VSAM 1
Search our Forums:

Back to Top