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 decimal value for Comp-4 Binary value 158

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

New User


Joined: 31 Jan 2006
Posts: 37

PostPosted: Fri Apr 13, 2012 5:37 pm    Post subject: Equivalent decimal value for Comp-4 Binary value 158
Reply with quote

Hi

Kindly let me know the equivalent decimal value for Comp-4 Binary value 158.

Thanks
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Apr 13, 2012 5:46 pm    Post subject: Reply to: Equivalent decimal value for Comp-4 Binary value 1
Reply with quote

Same as in COMP.
Back to top
View user's profile Send private message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 37

PostPosted: Fri Apr 13, 2012 5:53 pm    Post subject: Reply to: Equivalent decimal value for Comp-4 Binary value 1
Reply with quote

Is decimal value 344 equivalent to COMP-4 binary value 158.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Apr 13, 2012 6:04 pm    Post subject:
Reply with quote

No, decimal 158 is equivalent to COMP-4 binary value 158 -- the form of the number will not change the value. Hexadecimal value x'0158' has the value of 344 in decimal -- the representation of the number will determine the hexadecimal characters used to identify the value, but the value won't change.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Apr 13, 2012 6:11 pm    Post subject: Reply to: Equivalent decimal value for Comp-4 Binary value 1
Reply with quote

These days there are even PCs with calculators. Either "scientifc" or "programming".

The way we did it was just to learn base 16 maths. As an aid there was the old green/yellow card.

You have one 256, five 16s and eight. Add 'em all up. If you practice it, it'll work when you don't have ready access to a calculator and won't interrupt the "flow" of dump-reading/disk/tape viewing etc.

Or you can ask on a forum and take the knocks.
Back to top
View user's profile Send private message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 37

PostPosted: Mon Apr 16, 2012 2:20 pm    Post subject: Reply to: Equivalent decimal value for Comp-4 Binary value 1
Reply with quote

I have a binary value (pic 9(4) comp-4 type), with hex on gives 0135 .

I tried to convert this binary value to zoned decimal for display purpose using the below build function

BUILD=(1:51,2,BI,ZDF,LENGTH=4)

After the execution i got the zoned decimal value as 0309.

Please let me know if this is correct.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Mon Apr 16, 2012 2:25 pm    Post subject: Reply to: Equivalent decimal value for Comp-4 Binary value 1
Reply with quote

That would be one 256, three 16s and five.

Have you not even found the calculator?

At least you found DFSORT.

EDIT: There has to be something deeper here, doesn't there?

Code:
01  a-group.
    05  a-comp-4 comp-4 pic 9(4) value 309.

DISPLAY ">" a-group "<>" a-comp-4 "<"


Put it in a program. Compile, run. SET HEX ON for the output. You gave it 309, it gave you back 135 (from the hex display) and 309.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Apr 16, 2012 2:30 pm    Post subject: Reply to: Equivalent decimal value for Comp-4 Binary value 1
Reply with quote

is it so difficult to find out Yourself... icon_eek.gif
if it is so a career change is strongly suggested

don' t You have an hex/dec calculator ?
all the windoze systems have one

or just try to remember Your basic maths and ...

Code:
1 * 256 ==> 256 +
3 *  16 ==>  48 +
5 *   1 ==>   5 =
--------------------
        ==> 309
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 Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 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
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm


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