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
 

 

Data representation with negative values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 186
Location: chennai

PostPosted: Tue Jan 14, 2014 9:36 am    Post subject: Data representation with negative values
Reply with quote

Hi all

Could anyone please help me in understanding how -32 is represented with 03K.

Regards
Raghu
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jan 14, 2014 10:34 am    Post subject:
Reply with quote

Pleaae explain

I coudnt understand
Back to top
View user's profile Send private message
steve-myers

Active User


Joined: 30 Nov 2013
Posts: 460
Location: The Universe

PostPosted: Tue Jan 14, 2014 10:40 am    Post subject:
Reply with quote

I presume the text you are showing is text defined as "zoned decimal." The hexadecimal form of your field is F0F3D2.

Now be patient with me, because we are going back to ancient history.

Back in the days of punched card based data processing we had machines called card sorters. You have probably seen them in old movies. The operator puts a bunch of (presumably) punched cards into the machine and presses the start button. The machine sucks up the cards and distributes them to various pockets. The actor pulls out one of the cards, which presumably has the information he needs and the action continues.

Now what happened.

A traditional punched card has 80 "columns" of data, in 12 "rows." By convention, from the top of the card, the first two rows were not punched for numeric data, and were punched for letters and punctuation. The top row was called a 12 punch, and the next row an 11 punch. The remaining rows were punched for numbers, 0 through 9. Another convention: for numeric, signed data, the top row for the last column of a number was punched to indicate a positive number, and the second row was punched to indicate a negative number. Again, by convention, a column with 12-1 punched is the letter A, 11-1 is the letter J, 11-2 is K, and so on.

Each run through of a card sorter sorted one column. It could be set to distinguish the 12/11 punches, or the numeric fields.

Now when a punched card reader read cards, it would translate a 0 punch to F0, a 1 punch to F1, a 12-1 punch to C1, an 11-1 punch to D1, and so on.

Now, get out your Principles of Operation and turn to where it describes signs for packed decimal and zoned decimal data. In zoned decimal data the sign is the first 4 bits of the last byte of data: Cx or Fx is positive, Dx is negative. Similarly, with packed decimal data xF or xC is positive, xD is negative in the last byte of packed decimal data.

Now, I hope you see where this convention comes from.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Jan 14, 2014 1:14 pm    Post subject: Reply to: Data representation with negative values
Reply with quote

To complement what Steve has said, you have a PIC S999 (or S9*3), same thing).

If you DISPLAY that, or otherwise include it in any output, it will appear as 3K when it contains the value -32. When you look at a value like that, you need to "decode" it yourself to know that it contains (in this case) -32. If you look in this forum you will see a "Sticky" which maps the values. You can experiment with COMP-3/PACKED-DECIMAL and COMP/COMP-4/COMP-5/BINARY as well. With positive numbers you just get a di fferent set of "letters". Note the representation of +/- zero.

With unsigned numeric PICtures, you just have the numbers, as there is no other information to show you.
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 186
Location: chennai

PostPosted: Tue Jan 14, 2014 10:19 pm    Post subject: Reply to: Data representation with negative values
Reply with quote

Hi

Thanks to all for your response.
What I am looking for is the table, which I got from Bill's "Sticky".

Thanks Bill.

Thanks to everybody.

Regards
Raghu
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 ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
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 Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


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