Hex form in cobol



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Hex form in cobol

Postby Praveen5526 » Sun Apr 22, 2012 11:12 pm

I have hex form 102D and what is the actual value? how we can find it?
Praveen5526
 
Posts: 10
Joined: Sat Apr 21, 2012 6:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Hex form in cobol

 

Re: Hex form in cobol

Postby enrico-sorichetti » Sun Apr 22, 2012 11:14 pm

see here for all You might want to know about number representation

http://publibz.boulder.ibm.com/cgi-bin/ ... 0504121320
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Hex form in cobol

Postby Robert Sample » Mon Apr 23, 2012 12:25 am

You DO realize, I hope, that there is more than one answer to your question? The answer depends upon the USAGE clause for the variable in question. If the variable is COMP-3, the value is negative. If the variable is COMP, the value is positive. The actual values you can find, if you follow enrico's link.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Hex form in cobol

Postby BillyBoyo » Mon Apr 23, 2012 3:16 am

That's the very first sections in chapters 7 and 8 from enrico's post.

Why can't you find how the field is defined which gives you that value? That will help you a lot.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Hex form in cobol

Postby Praveen5526 » Tue Apr 24, 2012 12:03 pm

1 ===== 4096
0 ===== 0
2 ===== 32
D ===== ( - )Negative
----------
actual value = - 4128


Correct me if I am wrong.
Praveen5526
 
Posts: 10
Joined: Sat Apr 21, 2012 6:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Hex form in cobol

Postby enrico-sorichetti » Tue Apr 24, 2012 12:09 pm

You are wrong :geek:
( hint... You are mixing binary and packed representations )

review for the umpteenth time the packed concepts in the manual I pointed You to
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Hex form in cobol

Postby Robert Sample » Tue Apr 24, 2012 2:35 pm

You are wrong. The value of those hexadecimal digits is either -102 or +4141, depending.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Hex form in cobol

Postby BillyBoyo » Tue Apr 24, 2012 4:58 pm

What is the source of your hex value? When you see that in "memory" or a dump somewhere, it is not necessarily even "a number". It could be an instruction. It could be a chunk of storage that contains that value for some reason (it could be two individual bytes whose values are related, or unrelated, one byte may just contain a bit pattern, or any number of things). You might have picked up part of an address, so the "value" is actually longer, and you don't know where that value is, so can't know what it represents.

In short, to tell what "value" a particular hex representation has, you have to know specifically how it is used in that particular instance.

You can't look at a hex value in isolation and say "that has this value in decimal" because what you are looking at may be the hex of something you've previously seen as a numeric value, but in this case turns out not to be any sort of "number" at all.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Hex form in cobol

Postby Praveen5526 » Tue Apr 24, 2012 5:56 pm

I got it now.. Thank u all. Thank u somuch
Praveen5526
 
Posts: 10
Joined: Sat Apr 21, 2012 6:13 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post