View previous topic :: View next topic
|
Author |
Message |
ug123 Warnings : 1 New User
Joined: 01 Mar 2007 Posts: 39 Location: Chennai
|
|
|
|
Could anyone please tell me how to display a Comp variable in a Cobol program.
Thanks,
Ugandar |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Display usually works, might mess up the sign, but a move and display would fix that...... |
|
Back to top |
|
|
ug123 Warnings : 1 New User
Joined: 01 Mar 2007 Posts: 39 Location: Chennai
|
|
|
|
Actually i have a value 'FA60' which i can see in the hex format and the valid readable format for that value is 64096. I want to display this value.
Thanks,
Ugandar. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
ug123 wrote: |
Actually i have a value 'FA60' which i can see in the hex format and the valid readable format for that value is 64096. I want to display this value. |
If it is a signed two byte field, then it is -31328.
If the field is larger than two bytes, or unsigned, then 64096 is correct.
Try a "display dataname" and either get 64096 or 6409F or -31328 or 3132H.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Post the "comp variable" definition.
If you display a group field containing this, the display will not be what you want - you need to display the individual field. |
|
Back to top |
|
|
ug123 Warnings : 1 New User
Joined: 01 Mar 2007 Posts: 39 Location: Chennai
|
|
|
|
01 WS-BINARY.
05 WS-BINARY-N PIC 9(4) BINARY.
WS-BINARY contains X'FA60'
if we convert this to decimal we can get 64096
so i need to display 64096
can u tell me what I have to do for this
Thanks,
Ugandar |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Have you tried 'DISPLAY WS-BINARY-N'? |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
05 WS-DISPLAY-N PIC 9(005).
Try moving WS-BINARY-N to WS-DISPLAY-N and
DISPLAY WS-DISPLAY-N |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
so i need to display 64096 |
Do you really need to "display" this or do you need to make it visable in some report or on some panel?
If you explain the actual requirement, we can probably offer better suggestions. |
|
Back to top |
|
|
ug123 Warnings : 1 New User
Joined: 01 Mar 2007 Posts: 39 Location: Chennai
|
|
|
|
01 WS-BINARY.
05 WS-BINARY-N PIC 9(4) BINARY.
WS-BINARY contains X'FA60'
If we check the spool we can see the above value as below
F6
A0
The equivalent decimal value is 64096
i need to see 64096 in spool
can u plz tell me how it is possible
Thanks,
Ugandar |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
WS-BINARY is not a comp field it is a group item!
DISPLAY WS-BINARY-N. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Ugandar,
Was there a reason to completely repost you eariler post with no added info from you?
As you were told - do not display the group field.
You were also asked for some info. You should provide the requested info. . .
d |
|
Back to top |
|
|
ug123 Warnings : 1 New User
Joined: 01 Mar 2007 Posts: 39 Location: Chennai
|
|
|
|
Hi all,
Actually the problem is with compiler options.
i have changed the compiler options and now its working fine with the following code.
WS-BINARY
WS-BINARY-N PIC 9(4) BINARY.
WS-NUM PIC 9(5).
WS-NUM-N REDEFINES WS-NUM PIC 9(5) COMP.
MOVE WS-BINARY-N TO WS-NUM-N
Thanks,
Ugandar. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Sorry, but that makes no sense. . . It might work, but it is silly.
A 9(5) comp field is not a proper redefines for a 9(5) field.
If you had done what was suggested by using the original elementary field (which you are using now anyway), you would have succeeded without this strange addition to the code. . .
And there is no mention of some change to compiler options. |
|
Back to top |
|
|
|