Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Linkage Section

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

New User


Joined: 04 Oct 2005
Posts: 19
Location: Singapore

PostPosted: Wed Dec 02, 2009 9:28 am    Post subject: Linkage Section
Reply with quote

Hi

Please clarify my below doubt:

1. In a Called program , I get the input data via linkage section. Now usually we use these input data from linkage section in procedure division like

PROCEDURE DIVISION USING WS-VAR1.

where WS-VAR1 is defined in the linkage section.

Now my question is can I use these linkage section variables directly in the procedure division without coding
PROCEDURE DIVISION USING WS-VAR1 ?

2. Suppose program A is calling program B. So program B will have the linkage section to receive the input data from program A. But if program A wants to receive some output data from program B, should program A also needs to have Linkage section?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Dec 02, 2009 9:36 am    Post subject:
Reply with quote

1. this questions displays the fact that you have made no effort to read a COBOL application programming guide. read it...

2. If program A has a Procedure Division Using ..., the ... can be passed to Program B via CALL PGM B USING ....
If program A has no linkage, then Program A working storage can be passed via CALL PGM B USING ...

either way, upon return from PGM B, Pgm A can reference any of the data passed by CALL PGM B USING ... that was populated by PGM B.

linkage is a method whereby you can reference data areas defined in another module which calls you USING ...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Dec 02, 2009 9:40 am    Post subject:
Reply with quote

Hello,

Define the data area to be "2-way". In the calling module define an 01 that has all of the data fields to be used by the called module and then the fields to be "returned" from the called module. Or use 2 level 01 entries (and the CALL would use both, the linkage section would define both, and the USINGs would name both).

Keep in mind that the data is not really going anywhere - the linkage section refers to memory in the calling module. Between the CALL USING, the LINKAGE SECTION, and the USING in the called module, addressability is established.

Care must be taken to use the same type variables on both sides of the CALL.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Wed Dec 09, 2009 11:06 am    Post subject:
Reply with quote

Quote:
Now my question is can I use these linkage section variables directly in the procedure division without coding
PROCEDURE DIVISION USING WS-VAR1 ?

I guess you'll get a S0C4 if you reference these.
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 Number of parameters in Linkage kregen COBOL Programming 4 Wed Jan 27, 2016 5:13 pm
No new posts COBOL Parmlist and Associated Linkage... Bill O'Boyle COBOL Programming 10 Fri Dec 20, 2013 9:43 pm
No new posts Linkage Section for Three programs Mr.Niceguy COBOL Programming 13 Sat Jun 01, 2013 7:21 pm
No new posts Sort - Header on Page Break and Secti... srinathds83 SYNCSORT 7 Mon May 13, 2013 11:31 am
No new posts Low-values in linkage parameter Robert Sample COBOL Programming 7 Thu Feb 28, 2013 2:57 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us