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
 

 

Linkage section problem

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

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Wed Jul 28, 2010 5:45 pm    Post subject: Linkage section problem
Reply with quote

Program 1, Program 2 and Program 3 are calling a program say Program 4.

Program 1 is passing parameters A, B, C to Program 4
Program 2 is passing parameters B, C to Program 4.
Program 3 is passing parameters A, B to Program 4.


Program 1:

Code:
01 A  PIC X(10).
01 B  PIC X(9).
01 C  PIC X(8).

Call 'Program4' using A,B,C.


Program 2.

Code:
01 B  PIC X(9).
01 C  PIC X(8).

Call 'Program4' using B,C.


Program 3.

Code:
01 A  PIC X(10).
01 B  PIC X(9).

Call 'Program4' using B,C.



How do I code the Linkage section in Program 4 to handle this condition?

I declared linkage section in program 4 as follows:
Code:
01 A  PIC X(10).
01 B  PIC X(9).
01 C  PIC X(8).


and I was able to handle program 1 and program 3

using "If address of C = NULL."

But I am not able to handle program 2?
Can you please suggest me a way to do this?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Jul 28, 2010 5:51 pm    Post subject:
Reply with quote

your examples are inconsistent with your narrative.
hopefully your code is better.

if the following works:
if address of c = null

why not use it for all?

if address of a = null then...
if address of b = null then...
if address of c = null then...

??????

what is your problem?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8124
Location: East Dubuque, Illinois, USA

PostPosted: Wed Jul 28, 2010 5:54 pm    Post subject:
Reply with quote

Code:
CALL 'PROGRAM4' USING OMITTED, B, C
and test in PROGRAM4:
Code:
IF  ADDRESS OF A = NULL
...
Back to top
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Wed Jul 28, 2010 7:06 pm    Post subject: Reply to: Linkage section problem
Reply with quote

@dbzTHEdinosauer
Program 2 passes B, C to program 4
and in Program 4 all the 3 variables A, B, C are defined

as parameter passing is done positionally so
B from program 2 will get collected in A of program 4
C from program 2 will get collected in B of program 4

also as the datatypes of A, B, C are different so data collected in program 4 will be incorrect

so I cannot check "if address of A = NULL"....

@Robert Sample
I think "ommit" in calling program should work but I need to make changes to the called program (ie. program 4) because I have around 100 calling programs which are calling this program 4.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Jul 28, 2010 7:32 pm    Post subject:
Reply with quote

AMBy,

poor design based on inadequate knowledge leads you to the only solution,
which you have mentioned in your note to Robert.
Back to top
View user's profile Send private message
ChowHan

New User


Joined: 16 Oct 2009
Posts: 15
Location: India

PostPosted: Thu Jul 29, 2010 12:00 am    Post subject:
Reply with quote

I wonder what would be the performance overhead of keeping the size of linkage area variable as (10 + 9 + 8)?

10 for A
9 for B
and 8 for C

and moving spaces to A before calling from program 2 which will use only parameters B and C and spaces in the first 10 characters.

Or you could consider passing name of the calling module along with the data, if there are more modules and larger number of combinations .
You could pass some sort of op-code (f1 for fetching customer data, f2 for fetching contract data etc.....) that would identify what needs to be done with the data passed to the subroutine.

Just a thought... I have seen it some old code...
In any case, how was this handled earlier, since you are talking of 100 modules already calling this module? Is program-1 a new program that requires some new functionality from the subroutine?
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: Thu Jul 29, 2010 12:01 am    Post subject:
Reply with quote

Hello,

As you are still fairly early in the testing suggest you change the 100 programs to be consistent. . .

Hopefully the variables always contain the same type of info (i.e. A is a 3-byte alphanumeric, B is an 8-digit zoned-decimal, etc. . .)
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 Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am


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