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

Binary Number


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

New User


Joined: 17 Sep 2006
Posts: 24

PostPosted: Wed Aug 13, 2008 9:21 pm
Reply with quote

I have one requirement, I have my current copybook as

05 PPQ-NUM-DAYS PIC 9(2).
Now there is a change of copybook , which says
05 PPQ-NUM-DAYS PIC 9(4) COMP.
05 PPQ-NUM-DAYS-XTL REDEFINES
PPQ-NUM-DAYS PIC 9(2)..

Now when i look at my data through File Aid

I am seeing like this
PPQ-NUM-DAYS::::: PPQ-NUM-DAYS-XTL
2/BI :::::::::: 2/NUM
(71-72) ::::: (71-72)R
9-------------- ::::: 10---------------
61681 ::::: 1
61682 ::::: 2
61683 ::::: 3
61684 ::::: 4

Can you please explaim me on these Binary Integers, and how is it equivalent to the non comp numbers, I mean (BI) 61682 = (NUM) 2.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Aug 13, 2008 9:29 pm
Reply with quote

61681 in hex is F0F1. The USAGE DISPLAY value of a PIC 9(02) field with value 1 (that is 01) is ... F0F1.

Redefining a PIC 9(02) field as PIC 9(04) COMP can be quite problematic ... what's the business case for this?
Back to top
View user's profile Send private message
krishna_Murty
Warnings : 2

New User


Joined: 17 Sep 2006
Posts: 24

PostPosted: Wed Aug 13, 2008 9:41 pm
Reply with quote

Can you explain me please how can it be problematic, The business need is that Number of days , they forsee that they may increase to more number of dizits. Also F0F1 = 01, but how 61681 = 01, please can you explain. Like how we have HEX ON compand , can we have Binary on comand

Please guide me here. And thank you for your sooner reply.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Aug 13, 2008 10:44 pm
Reply with quote

The problem is that a COMP field accepts everything as a valid value. So the hex value for a DISPLAY field of 01 is F0F1; the COMP value for this number is 61681. So how do you know if F0F1 represents a DISPLAY value of 01 days or 61681 days?

Fire up the Windows calculator in scientific mode, enter 61681 as a decimal value then hit the HEX button. The display changes to F0F1, which is the hex value of 61681. Numbers only have meaning as agreed, and there are conflicting agreements possible with F0F1 -- as a COMP field it is 61681 decimal; as a COBOL DISPLAY field it is 01. You pays your money and takes your pick -- change the agreement you change the value. This is why I said it's problematic to do this.
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: Thu Aug 14, 2008 2:31 am
Reply with quote

Hello,

Also, keep in mind that if the change is to accomodate more "days", all of the current values would need to be "converted" when the new copybook was activated. To do otherwise would become a maintenance nightmare. . .

Looking a bit further, "old" versions of the file (if this copybook is part of a file) may need to be converted as well if they are to be used.
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 Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top