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

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: 7314

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: 39

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: 8200
Location: East Dubuque, Illinois, USA

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: 7314

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: 39

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: 7314

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: 10374
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 CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am

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