View previous topic :: View next topic
|
Author |
Message |
deb_parthas
New User
Joined: 24 Nov 2005 Posts: 18
|
|
|
|
Hi Frnds,
I need a help.. I have a cobol declaration as S9(12)V99 and the values for this field are being displayed as 0000000000000B, 0000000000000{, 0000000000000K, 0000000000015J. Could you pls let me know what these values are in numeric. Is there a table available for these converions?
Also, if I need to negate these values from another S9(12)V99 value, how do I do that?
Thanks for any input,
Partha |
|
Back to top |
|
|
steve
New User
Joined: 24 Mar 2005 Posts: 16 Location: Long Island
|
|
|
|
What you are getting is a Junk.. initialize them with VALUE 0 in the delcaration section. You should get proper output.. |
|
Back to top |
|
|
hemanta
New User
Joined: 09 May 2006 Posts: 5
|
|
|
|
Hi partha the corresponding numeric values are
+02
+00
-01
+150 |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi hemanta,
How do You find the numeric values used by deb_parthas in his query ? |
|
Back to top |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Do HEX ON
You will get the Values of that
Correct me if I am wrong |
|
Back to top |
|
|
hemanta
New User
Joined: 09 May 2006 Posts: 5
|
|
|
|
Hi Anuj,
in Mainframe the values are sometimes stored like this
If the right most digit is any letter between A to I then the corresponding number is +1 to + 9
If the right most digit is any letter between J to R then the corresponding number is -1 to - 9
So if the number is 15J it is acutually -151 .
sorry i have told it as 150
+0 is will be represented as {
-0 will be represented as }
so 15} is -150
and 15{ is +150
Think now u r clear |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Hello,
hemanta gave the closest good answer:
Quote: |
If the right most digit is any letter between A to I then the corresponding number is +1 to + 9
If the right most digit is any letter between J to R then the corresponding number is -1 to - 9
+0 is will be represented as {
-0 will be represented as } |
But he didn't take into account that the field is defined with V99, so the values are:
000B -> +0.02
000{ -> +0.00
000K -> -0.02
015J -> -1.51
If you want to correctly DISPLAY the values, use an interim field, for example:
Code: |
01 DISPL-NUM PIC +(11)9.99.
MOVE YOUR-FIELD TO DISPL-NUM
DISPLAY DISPL-NUM ' WILL SHOW OK' |
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
hemanta wrote: |
so 15} is -150
and 15{ is +150 |
Hi hemanta,
Can you please direct me to some link or provide me some documnet on this. That'll help me rather better. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What you are seeing is the proper values for signed zoned-decimal numbers. With a zoned-decimal (PIC S9(n)), the sign is placed in the high-order nibble (1/2 byte) of the low-order byte.
There is no table needed - if you display those values from a program, the expected values will be presented. If you want to "see" the actual values, HEX ON works well.
You will notice that signed positive values from zero to nine are from x'C0-C9' and negative values are from x'D0-D9'. If you see values from x'F0-F9' they are unsigned values that are assumed positive if used in a calculation or a compare.
Steve - why would you think they were junk? That is completely inaccurate. . . |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Thanks for the explanation Dick.
I thought about an exercise-type documentation. I know about HEX-ON/OFF, values represented by them & played with them a bit..but sometimes they puzzle me, so asked. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
That's why we're here. . . |
|
Back to top |
|
|
|