Re: Identifting sign in COMP data
- From: kimi <mraghu83@xxxxxxxxx>
- Date: Fri, 29 Jun 2007 00:00:52 -0700
On Jun 28, 10:14 pm, Louis Krupp <lkr...@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:
kimi wrote:
On Jun 28, 1:36 pm, Louis Krupp <lkr...@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:
kimi wrote:
Hi ppl,Hi, Kimi!
Can anyone tell me how to recognize whether the COMP
variables are negative or positive.
For instance in COMP-3 data , if the last nibble is 'C' then we say it
is positive and if it is 'D' or 'F' we say it is negative.
Similarly how can we recognize whether the number is positive or
negative in COMP , COMP-1 and COMP-2 data.
Do you actually have COMP-3 data in which the last nibble is 'F' and
this indicates a negative number? This ... surprises me.
For COMP data, it's probably safe to assume (someone correct me if I'm
wrong) that the high-order bit indicates the sign; if the bit is on,
the number is negative. The value as a whole is *probably*
twos-complement, but I've worked on systems that used sign-magnitude.
For COMP-1 and COMP-2, the high-order bit *probably* indicates the sign
(just like with COMP), but it depends on the floating-point format, and
you'll have to know what format you're using before you can get anything
else out of the data.
Is this part of your project to read COMP-1 and COMP-2 data from your
mainframe? Out of curiosity, how's that going? And which mainframe is it?
Louis
tnx for that guys..!!
No louis this isnt a part of that project...
Well,i am moving the COMP-1 and COMP-2 data to COMP-3 as we discussed
in the other thread..
I did try out setting the environment variables and all that... but
doesnt work..
Probably need to know the right way to set it..
Sounds like this *is* part of the same effort, and now you need to know
how to interpret COMP-3 data that comes from the mainframe. You haven't
mentioned *which* mainframe...
A couple of ideas:
1. What Michael said -- use "PACKED DECIMAL" instead of "COMP-3"; it
sounds like that should be portable. Just move the floating point
fields to packed fields (be sure to give them a picture S9x.y); the
system will take care of the sign.
2. If you run into range issues with your COMP-1 (or, more likely,
COMP-2) data, go with one of my earlier suggestions about splitting the
floating point value into an exponent and a mantissa. Store those as
COMP, move the data to your UNIX system, and then put it all back
together into floating point.
Louis- Hide quoted text -
- Show quoted text -
This is not a part of that effort...
I wanted the information on sign of packed variables for something
else which i am coding in REXX..
.
- References:
- Identifting sign in COMP data
- From: kimi
- Re: Identifting sign in COMP data
- From: Louis Krupp
- Re: Identifting sign in COMP data
- From: kimi
- Re: Identifting sign in COMP data
- From: Louis Krupp
- Identifting sign in COMP data
- Prev by Date: Re: Identifting sign in COMP data
- Next by Date: Re: (OT) The desktop supercomputer has arrived!
- Previous by thread: Re: Identifting sign in COMP data
- Next by thread: Re: Identifting sign in COMP data
- Index(es):
Relevant Pages
|