COMP-1 And Comp-2 representation



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

COMP-1 And Comp-2 representation

Postby coollearner » Sat Jun 05, 2010 6:40 pm

Hi All,

I have referred the following link
http://publibz.boulder.ibm.com/cgi-bin/ ... 0820210412

in this link :

Internal floating point
COMP-1
+ 1234
43 4D 20 00

- 1234
C3 4D 20 00

COMP-2
+ 1234
43 4D 20 00 00 00 00 00

- 1234
C3 4D 20 00 00 00 00 00

I want to know how the conversion happened?
The hexvalue of 1234 is 4D2. How did the 43 4D 20 00 got generated. Please explain
Knowledge is wealth
coollearner
 
Posts: 33
Joined: Thu Jun 03, 2010 3:15 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COMP-1 And Comp-2 representation

Postby enrico-sorichetti » Sat Jun 05, 2010 7:15 pm

how do You expect to make a career in it with such a lack of ingenuity :D

please reread and uderstand the manual or better a bit of number representation theory
comp-1 and comp-2 as the manual says are floating point representations

see the pattern for binary representation of a positive 1234 ,
search for a similar pattern in the comp-1 representation
and meditate on the meaning of mantissa and exponent for floating point representation
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: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: COMP-1 And Comp-2 representation

Postby Robert Sample » Sat Jun 05, 2010 8:01 pm

From the very manual that you have a link to in your post:

1.3.4.6 Internal floating-point (COMP-1 and COMP-2) items

COMP-1 refers to short floating-point format and COMP-2 refers to long floating-point format, which occupy 4 and 8 bytes of storage, respectively. The leftmost bit contains the sign and the next 7 bits contain the exponent; the remaining 3 or 7 bytes contain the mantissa.

COMP-1 and COMP-2 data items are stored in zSeries® hexadecimal format.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post