View previous topic :: View next topic
|
Author |
Message |
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi,
I want to know how can we convert COMP-2 to ZD (Readable format) in Syncsort?
Suppose the value is 1.19875E3 it should get converted to 1198.75 |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
How many decimal places do you want to keep?
If 2, multiply the FL by 100 first
If 3, multiply the FL by 1000 first
If 4, multiply the FL by 10000 first
etc |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Its not working for me....
My value is
Code: |
+5.345000000000000E+01
|
Can anyone please help me in getting the value as -
using syncsort. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You know the drill. "It's not working" is useless.
You originally asked for it to go to ZD. ZD does not contain ".". You'd need an edit mask to get it to appear with the ".".
It seems you want six decimal places.
Your typical ZD in a sort has no implied decimal places (or, another way, it has any number of implied decimal places, you just have to do the implying seperate to the field).
So, say you have 10 bytes. You want six for the decimal places.
If you transfer the floating to the ZD, you will loose low-order significance unless you specifically code for it, as there is no implicit decimal in the ZD.
So, for six places, multiply by 1000000 first, then transfer to the ZD.
If this does not work, show what it does do, please. |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi Bill,
I tried using this -
Code: |
//STEP050 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=ITA.TEST.AJ.WORK.XMITIN.EWHOLD01,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(01:58,8,
09:C' ',
10:58,8,FL,MUL,+1000000,EDIT=(TTT.TTTTTT))
/*
|
But still not getting the output
Code: |
=COLS> ----+----1----+----
****** *******************
000001 â Ë 053.000000
000002 000.000000
000003 â ÌéÔe ½ 017.000000
000004 000.000000
000005 000.000000
000006 000.000000
000007 â 'øtP 052.000000
000008 000.000000
000009 â ¿e ½éÖ 016.000000
000010 000.000000
|
In Hex
Code: |
=COLS> ----+----1----+----
****** *******************
000001 â Ë 053.000000
437333334FFF4FFFFFF
253333330053B000000
--------------------------
000002 000.000000
000000004FFF4FFFFFF
000000000000B000000
--------------------------
000003 â ÌéÔe ½ 017.000000
4175E81B4FFF4FFFFFF
2181B5E80017B000000
--------------------------
000004 000.000000
000000004FFF4FFFFFF
000000000000B000000
--------------------------
000005 000.000000
000000004FFF4FFFFFF
000000000000B000000
--------------------------
000006 000.000000
000000004FFF4FFFFFF
000000000000B000000
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Mmmm.... I was thinking you wanted it in a ZD first, then could apply the edit the to ZD.
However, the approach you have taken might be hinting that this won't work either. On the other hand, you are getting more than one digit of integer.
Try just converting it to ZD so you know whether that route works. If not, back to the drawing board.
Have you got a SYNCSORT manual? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
gylbharat,
After I got a big hint, this is not going to work. Any arithmetic is only going to apply to the integer part of the floating-point number, so the fractional part cannot be made into "integer" by multiplication. Sorry about that.
Fancy a little Cobol to do it? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Why might this need to be people-readable?
The computers have no trouble at all with the float format and if any real processing is to be done, i expect it is to be with computers. |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi Dick,
There is requirement where we have to FTP this file to a Unix box and there while processing this , the columns should be in a readable format. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Last i heard, UNIX works with floating point. . .
Probably there is something i misunderstand. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Hello,
Good old EBCDIC-to-ASCII translation. Good way to garble "non-display" fields, as all sorts of values for "control codes" in your binary fields get translated rather than left asis, let alone if you happen to have values which are "display" in your fields, they'll go mess about with themselves as well.
I know you're aware of this :-)
Also, is the Unix 7-bit? Is the float the same internal format? Best way to go for display, my opinion. |
|
Back to top |
|
|
|