View previous topic :: View next topic
|
Author |
Message |
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Code: |
CALL 'PROGRAM4' USING OMITTED, B, C |
and test in PROGRAM4:
Code: |
IF ADDRESS OF A = NULL
... |
|
|
Back to top |
|
|
Amb
New User
Joined: 12 Mar 2010 Posts: 64 Location: India
|
|
|
|
@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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
ChowHan
New User
Joined: 16 Oct 2009 Posts: 15 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|