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

Linkage Section


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Wed Dec 02, 2009 9:36 am
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

Moderator Emeritus


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

PostPosted: Wed Dec 02, 2009 9:40 am
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
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 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 FD Section to Create FB or Vb File Dy... COBOL Programming 1
No new posts OPTLINK linkage convention PL/I & Assembler 3
No new posts Sections: need one appearance of cer... DFSORT/ICETOOL 4
Search our Forums:

Back to Top