IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Equivalent Numeric Sign Values for B, {, K and J


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
deb_parthas

New User


Joined: 24 Nov 2005
Posts: 18

PostPosted: Fri May 12, 2006 7:48 am
Reply with quote

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
View user's profile Send private message
steve

New User


Joined: 24 Mar 2005
Posts: 16
Location: Long Island

PostPosted: Fri May 12, 2006 12:19 pm
Reply with quote

What you are getting is a Junk.. initialize them with VALUE 0 in the delcaration section. You should get proper output..
Back to top
View user's profile Send private message
hemanta

New User


Joined: 09 May 2006
Posts: 5

PostPosted: Fri May 12, 2006 12:42 pm
Reply with quote

Hi partha the corresponding numeric values are
+02
+00
-01
+150
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri May 12, 2006 6:37 pm
Reply with quote

Hi hemanta,

How do You find the numeric values used by deb_parthas in his query ?
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Fri May 12, 2006 6:57 pm
Reply with quote

Do HEX ON

You will get the Values of that

Correct me if I am wrong
Back to top
View user's profile Send private message
hemanta

New User


Joined: 09 May 2006
Posts: 5

PostPosted: Mon May 15, 2006 9:33 am
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon May 15, 2006 6:03 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 08, 2007 9:23 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 08, 2007 9:41 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Jun 11, 2007 9:30 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jun 11, 2007 9:40 pm
Reply with quote

You're welcome icon_smile.gif

That's why we're here. . .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Convert HEX to Numeric DB2 3
Search our Forums:

Back to Top