Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 194
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: 1568
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 Member


Joined: 30 Nov 2013
Posts: 753
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: 7312

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: 194
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 How to place name of the file where t... danielgp89 DFSORT/ICETOOL 5 Thu Oct 17, 2019 12:55 am
No new posts How to force ISPF to allocate ISPF te... Michele Giannuli TSO/ISPF 9 Thu Sep 12, 2019 2:03 pm
No new posts Need to fetch data from database base... Satandale COBOL Programming 8 Sun Sep 08, 2019 12:01 am
No new posts How to append data from PARM in OUTFIL Poha Eater DFSORT/ICETOOL 17 Thu Aug 22, 2019 4:03 pm
No new posts Training on numeric fields data formats sergeyken SYNCSORT 12 Thu Aug 01, 2019 8:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us