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
 

 

More variables in Linkage section

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: More variables in Linkage section
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    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Wed Feb 13, 2008 12:55 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 14, 2008 6:48 am    Post subject: More variables in Linkage section
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    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 DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Is it possible to pass variables of s... Csongor CLIST & REXX 2 Fri Jun 10, 2016 7:33 pm


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