View previous topic :: View next topic
Author
Message
kalyan.v New User Joined: 04 Feb 2008Posts: 65 Location: Hyd
Hi All,
I have data like below in a file.
Code:
C(1-10)
----------
-456.99
22479
9289
26659.13
39999
-34859
But i need data should be like this:
Code:
-000456.99
022479.00
009289.00
026659.13
039999.00
-034859.00
Please let me know how we can do this using syncsort?
Thanks,
Kalyan V
Back to top
hailashwin New User Joined: 16 Oct 2008Posts: 74 Location: Boston
Hi,
Try this card, it should work..
Code:
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,10,SS,NE,C'.'),
OVERLAY=(8:C'.00',20X),HIT=NEXT),
IFTHEN=(WHEN=(1,10,SS,EQ,C'.'),
BUILD=(1:1,10,SQZ=(SHIFT=RIGHT)),HIT=NEXT),
IFTHEN=(WHEN=(25,1,CH,EQ,C' '),
FINDREP=(STARTPOS=1,ENDPOS=10,IN=C' ',OUT=C'0'),HIT=NEXT),
IFTHEN=(WHEN=(1,10,SS,EQ,C'-'),
OVERLAY=(1:C'-'),HIT=NEXT),
IFTHEN=(WHEN=(2,9,SS,EQ,C'-'),
FINDREP=(STARTPOS=2,ENDPOS=9,IN=C'-',OUT=C'0'),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,NE,C'-'),
OVERLAY=(1:C' '))
Thanks,
Ashwin.
Back to top
abraralum New User Joined: 19 Dec 2010Posts: 42 Location: Bangalore
Try below, you need to give the editing characters as per your requirement
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
789
0001
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1,4,UFF,EDIT=(TTTT))
/*
Hope this helps ....
Back to top
hailashwin New User Joined: 16 Oct 2008Posts: 74 Location: Boston
abraralum,
I doubt this will solve the given scenario where there are fractionals for only some data. You will some how have to force the decimal point or else it would be misplaced.
Please correct me if I am wrong.
Thanks,
Ashwin.
Back to top
abraralum New User Joined: 19 Dec 2010Posts: 42 Location: Bangalore
I came through something like today at my work ... but I have not tested the below sort card.
Code:
INREC OVERLAY=(1,4,UFF,EDIT=(TTTT.TT))
Back to top
hailashwin New User Joined: 16 Oct 2008Posts: 74 Location: Boston
I did try the below code and it did not work. I found the decimal point getting misplaced. But I am not sure if am missing something.
Code:
OPTION COPY
INREC OVERLAY=(1,8,UFF,EDIT=(STTTTT.TT),SIGNS=(+,-,,))
But the earlier code which i posted would work even if it seems to be a bit round about way. Anyway, there should be a better way of doing it.
Thanks,
Ashwin.
Back to top
hailashwin New User Joined: 16 Oct 2008Posts: 74 Location: Boston
No offense, but I would say we should try out the code before posting it as a solution.
Thanks,
Ashwin.
Back to top
Please enable JavaScript!