Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
kamesh20

New User

Joined: 07 Mar 2007
Posts: 2
Location: Mumbai

 Posted: Thu Jun 04, 2009 6:12 am    Post subject: Moving an alphanumeric value and numeric value to 9(4)comp-5 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.

dick scherrer

Site Director

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

Posted: Thu Jun 04, 2009 6:42 am    Post subject:

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.
Robert Sample

Global Moderator

Joined: 06 Jun 2008
Posts: 8339
Location: Dubuque, Iowa, USA

 Posted: Thu Jun 04, 2009 6:42 am    Post subject: 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.
kamesh20

New User

Joined: 07 Mar 2007
Posts: 2
Location: Mumbai

 Posted: Thu Jun 04, 2009 8:13 pm    Post subject: 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.
dick scherrer

Site Director

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

 Posted: Fri Jun 05, 2009 1:10 am    Post subject: Reply to: Moving an alphanumeric value and numeric value to 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
Bill O'Boyle

CICS Moderator

Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

 Posted: Fri Jun 05, 2009 3:53 am    Post subject: Reply to: Moving an alphanumeric value and numeric value to 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,
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us