Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Equivalent Numeric Sign Values for B, {, K and J
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    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Fri May 12, 2006 6:37 pm    Post subject:
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: 171
Location: Bangalore

PostPosted: Fri May 12, 2006 6:57 pm    Post subject:
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    Post subject:
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: 1224
Location: Israel

PostPosted: Mon May 15, 2006 6:03 pm    Post subject:
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

Senior Member


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

PostPosted: Fri Jun 08, 2007 9:23 pm    Post subject:
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

Site Director


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

PostPosted: Fri Jun 08, 2007 9:41 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Jun 11, 2007 9:30 pm    Post subject:
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

Site Director


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

PostPosted: Mon Jun 11, 2007 9:40 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us