Page 1 of 1

Adding zeros in a flat fiel using SORT

PostPosted: Thu Jan 21, 2010 3:32 pm
by raz832
Hi,

I need some guidance on the SORT card.Can we add zeros using SORT card.
The input looks like
11111222223333444444

Output should look like

000022222000000000000

Could you please help me on how can we do this using SORT?
Thanks,
Rajesh.C

Re: Adding zeros in a flat fiel using SORT

PostPosted: Thu Jan 21, 2010 10:45 pm
by Frank Yaeger
I'm not sure exactly what you want to do here since your example is rather confusing. But if you want to overlay everything except the 22222 field with character zeros (C'0'=X'F0'), you can do it with a DFSORT job like this:

//S1    EXEC  PGM=SORT                   
//SYSOUT    DD  SYSOUT=*                 
//SORTIN DD *                           
11111222223333444444                     
//SORTOUT DD SYSOUT=*                   
//SYSIN    DD    *                       
  OPTION COPY                           
  INREC OVERLAY=(1:5C'0',11:10C'0')     


SORTOUT would have:

00000222220000000000 


If that's not what you want to do, then you need to explain more clearly what it is you want to do with a good example. Use ubb code tags for the example.