| Author |
Message |
morfius9 Warnings : 1 New User
Joined: 22 Feb 2006 Posts: 14
|
|
|
|
Hi,
I am trying to move a numeric value in a comp field to a comp - 3 field. But i end up with spaces in the X(16) redefines for the comp - 3 field. Why is that so?
B1 PIC 9(16) COMP.
B2 PIC 9(15) COMP-3.
b3 redefines b2 pic X(08).
MOVE B1 to B2.
display B3 |
|
| Back to top |
|
 |
References
|
Posted: Mon May 12, 2008 12:00 pm Post subject: Re: how to move comp value to comp-3? |
 |
|
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 6031 Location: 221 B Baker St
|
|
|
|
Hello,
What you have coded makes no "cobol" sense. A comp-3 field is not displayable as an X field - by design.
If you want to display the B2 comp-3 field, simply display it
|
|
| Back to top |
|
 |
morfius9 Warnings : 1 New User
Joined: 22 Feb 2006 Posts: 14
|
|
|
|
Hi DS,
I want to display the HEX value in the 9(16) comp-3 field .
e.g. if the number is stored as 6CBF in hex inside the 9(16) comp-3, i want to display 6CBF and not the number on a CICS screen. Is it possible? |
|
| Back to top |
|
 |
Atul Tamboli
New User
Joined: 12 May 2008 Posts: 2 Location: Pune, India
|
|
|
|
If you move the comp-3 field into the numeric field, the actual number can be displayed using numberic field. In your case say you do-
Define ==> B4 PIC 9(15).
MOVE B2 to B4
DISPLAY B4
You should get a readable number in output. |
|
| Back to top |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 709 Location: Virginia, USA
|
|
|
|
| Cobol does not have a way to display data in hex. Converting data to hex display is something you have to do yourself. Check with the more experienced programmers on your project and see if they have a routine for doing that. |
|
| Back to top |
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 1001 Location: At my desk
|
|
|
|
| morfius9 wrote: |
| if the number is stored as 6CBF in hex inside the 9(16) comp-3, i want to display 6CBF and not the number on a CICS screen. Is it possible? |
6CBF is not numeric in a comp-3 field, did you mean the comp field?
6CBF binary is 27839 decimal.
There have been several threads on converting to a display form of hex values.....
Try Display Hexadecimal Value in Cobol Program.... |
|
| Back to top |
|
 |
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1421
|
|
|
|
morfius9,
You can also do the following:
When looking at sysout (I assume you're using SDSF) use SE in the left side cmd line. Locate your comp-3 field then enter HEX in the top cmd line.
This will show you the nibbles of the displayed field.
I usually display fields using DISPLAY ' >' MY-COMP-3 '< '. It let's me know where the displayed data is on the line. |
|
| Back to top |
|
 |
|
|