IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reformating numeric data using sync sort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kalyan.v

New User


Joined: 04 Feb 2008
Posts: 65
Location: Hyd

PostPosted: Tue Mar 29, 2011 7:09 pm
Reply with quote

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
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Apr 01, 2011 6:08 pm
Reply with quote

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
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Sat Apr 02, 2011 10:41 pm
Reply with quote

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))
/*



Code:

0789
0001


Hope this helps ....
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Thu Apr 07, 2011 4:02 pm
Reply with quote

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
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Thu Apr 07, 2011 8:52 pm
Reply with quote

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
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Apr 08, 2011 10:28 am
Reply with quote

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
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Apr 08, 2011 10:34 am
Reply with quote

No offense, but I would say we should try out the code before posting it as a solution.

Thanks,
Ashwin.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top