View previous topic :: View next topic
|
Author |
Message |
kamesh20
New User
Joined: 07 Mar 2007 Posts: 2 Location: Mumbai
|
|
|
|
Hi,
We have a calling program that has the variable declared as x(5) - say it is 'A'.
we move the value of this variable to a 9(4) comp-5 variable - say it is 'B'.
We pass the variable 'B' to the called program and move it to a variable x(4)- say it is 'C'.
The problem is coming for the below cases:
For example -
'A' has two values - 1)T020
2)58132
When we are moving these values to the variable B it has the value E314 for the above two values of A also.
In the called program when we are moving this B (E314) to the variable C, the C(1:1) has the value 'T' (equal to char form of 'E3') for both the values of A (T020, 58132).
But we want to know what is the actual value came in (whether it is T020 or 58132)
Please let me know if there is a way..
Constarints:
Pass area to the called program can not be increased or changed. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
we move the value of this variable to a 9(4) comp-5 variable - say it is 'B'. |
Why?
Quote: |
We pass the variable 'B' to the called program and move it to a variable x(4)- say it is 'C'. |
Again, why. . .?
Quote: |
For example -
'A' has two values - 1)T020
2)58132 |
Valu one is missing one byte. . . the field is x(5).
What you are trying to do is confusing - at best. A value is a value is a value.
Each byte have a hex pattern from x'00' to x'ff'. How you choose to use them is your choice. An x'e3' is an x'e3' or a decimal 227. An x'e314' is decimal 58132.
From the data there is no way to know the "intent".
Suggest someone concern them self with cleaning up this code.
You might consider multiple entry points into the called module - one for each "use" of the data. . .
If you explain what the process is supposed to accomplish, someone may have a suggestion. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Although your explanation is not entirely clear to me, I do not believe that what you want to know can be determined. x'E314' is a COMP-5 variable that can also be represented as character 'T?' where the ? is a hex 14 (decimal 20) value. The power of COMP-5 is that any pattern of bits represents a valid number. The downside of COMP-5 is that you cannot tell if the variable started as a number such as 58132 or as a character string 'T?' without recourse to external data telling you which format to use. |
|
Back to top |
|
|
kamesh20
New User
Joined: 07 Mar 2007 Posts: 2 Location: Mumbai
|
|
|
|
Hi Dick and Robert,
Yes i know it is very confusing and bit difficult to put on a paper.
The code was written a way back and the issue came up now. May be we have to change the design now..
Thanks for your time and sorry for trouble if any. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - and no trouble
Given the constraints, not much more we could offer.
If there are questions, do post them - we can work on making them more understandable if needed
d |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Have you considered using EXTERNAL WORKING-STORAGE (introduced with VS/COBOL II some 20+ years ago), which must be defined exactly the same in both the Calling program and the Called program (in fact, all programs within the run-unit) and is addressable by all programs within the run-unit?
Then, the parmlist doesn't need to be changed and the sub-program can address this EXTERNAL WS directly, after being populated by the calling-program. Just a little bit of logic change here and there, in both programs and you're done! No conversion required or any type of value "subtlety" to consider.
Although some may perceive this approach as merely a "bandaid", using EXTERNAL WS has saved my A$$ several times....
Regards, |
|
Back to top |
|
|
|