Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- From: kimi <mraghu83@xxxxxxxxx>
- Date: Fri, 22 Jun 2007 22:35:40 -0700
On Jun 23, 10:14 am, "Pete Dashwood"
<dashw...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"kimi" <mragh...@xxxxxxxxx> wrote in messageThanks for that Pete. I'l try out this and let u know.
news:1182571670.971157.206720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jun 22, 4:38 pm, "Michael Mattias" <mmatt...@xxxxxxxxxxxxxx> wrote:
"Louis Krupp" <lkr...@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:137naara153c81a@xxxxxxxxxxxxxxxxxxxxx
kimi wrote:
HI ppl,
i have migrated the data on mainframe to SOLARIS UNIX.
COMP-1 and COMP-2 is read as junk when the application is
run on this data.
But COMP and COMP-3 data are read fine.
I have Microfocus Server Express 4.0 SP2 installed in my
UNIX system.
I believe This issue has something to do with the way the
operaring system interprets it.
Is there a way in which i can read this COMP-1 and COMP-2
data successfully??
As far as I know, COMP-1 and COMP-2 are floating point. Your mainframe
(IBM?) probably uses its own floating point format, and your Sun uses
IEEE
floating point. The bits are interpreted differently. It's an
architecture difference and doesn't have much to do with the operating
system.
Depending on the range of your floating point data, you might be able
to
convert the file on the mainframe so it only uses COMP-3 (packed
decimal),
or you could try to find a program that will do the conversion on
Solaris.
You could also write such a program (but you probably wouldn't want to
do
it in COBOL).
COMP-3 doesn't help. This is an ASCII-EBCIDC character set issue, which
is
only going to be solved by putting all the data into USAGE IS DISPLAY
format. (Or by handling ASCII-EBCDIC conversions on a field-by-field
basis
on either end of the file transfer).
OKey.. Now say I am moving COMP-1 to DISPLAY field..
The COMP-1 data is say 21.234, it will be stored as 0.21234E+02.
Now if i move it to a display field with PIC S9(8)V999, In This case i
would get the right value..But,
If i decide to move it to say PIC S9(8)V99, In this case the value in
the DISPLAY field would'nt be in SYNC with the COMP-1 field.
So, can u pls tell me how would i know what is the PICTURE clause i
have to specify in the program for the display field...???
Here's one approach that might help...
WORKING-STORAGE SECTION.
...
01 integer-part pic 9(n). *> n = the limit for your compiler,
typically 18.
01 decimal-part pic v9(n).
01 float-double comp-2.
01 counts comp value zero.
12 leading-count pic s9(4).
12 trailing-count pic s9(4).
12 length-to-move pic s9(4).
01 display-string pic x([2n + 1]). *> n = the limit for your compiler,
typically 18....so pic x(37), in that case.
PROCEDURE DIVISION.
...
BUILD-DISPLAY-STRING.
move float-double to integer-part decimal-part
string
integer-part
delimited by size
"."
delimited by size
decimal-part
delimited by size
into display-string
end-string
move zero to leading-count trailing-count
inspect display-string
tallying leading-count leading zeroes.
inspect REVERSED display-string
tallying trailing-count leading zeroes.
compute length-to-move = [2n + 1] - leading-zeros + trailing-zeros
*> see formula above.
move display-string (leading-count + 1: length-to-move) to
display-string
At this point display-string (hopefully :-))contains a left justified
representation of your original float, without any loss of precision,
irrespective of how many places it has, within the limits of your COBOL
implementation.
Your example: 0.21234E+02 appears as: 21.234
0.212345678901234E+10 appears as: 21234.5678901234 etc.
DISCLAIMER: I have NOT compiled and tested this code. It is intended to show
an approach, and may contain minor syntax or logical errors. If you use it,
step through it with a debugger.
Pete.
See my tutorial on the subject
athttp://www.talsystems.com/tsihome_html/downloads/C2IEEE.htm
FWIW, both COMP-1 and COMP-2 are "implementor defined" data formats. With
IBM mainframe COBOL, it's either IBM proprietary format or IEEE single
(COMP-1) or IEEE double (COMP-2) depending on the setting of the FLOAT
directive at compile time===> FLOAT ([HEX |NATIVE] | IEEE)
--
Michael C. Mattias
Tal Systems Inc.
Racine WI
mmatt...@xxxxxxxxxxxxxxx Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
.
- References:
- COMP-1 and COMP-2 resolution on unix (using microfocus)
- From: kimi
- Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- From: Louis Krupp
- Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- From: Michael Mattias
- Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- From: kimi
- Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- From: Pete Dashwood
- COMP-1 and COMP-2 resolution on unix (using microfocus)
- Prev by Date: Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- Next by Date: Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- Previous by thread: Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- Next by thread: Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- Index(es):
Relevant Pages
|
|