Reformatting file using Syncsort



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Reformatting file using Syncsort

Postby Marina Lozovatsky » Thu Dec 18, 2008 3:28 am

Is that possible to get rid of spaces and shift data up? (please see example below)
PRO   00001  00001  AAA                           
PRO   00001  00001  BBB                           
PRO   00001  00001  AAA       
PRO   00001  00001  AAA                       
                                     CTR   00001  00001  CCC
                                     CTR   00001  00001  BBB
                                     CTR   00001  00001  BBB
                                     CTR   00001  00001  AAA   

I also need to sum some fields and get something like:
PRO   00001  00003  AAA            CTR   00001  00001  CCC       
PRO   00001  00001  BBB            CTR   00002  00002  BBB       
                                   CTR   00001  00001  AAA       


Thanks!
Marina Lozovatsky
 
Posts: 2
Joined: Thu Dec 18, 2008 1:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Reformatting file using Syncsort

Postby dick scherrer » Thu Dec 18, 2008 4:02 am

Hello Marina and welcome to the forum,

Please review your post and let us know if the output is exactly the way it is needed.

Is there some reason that the aaa,bbb,ccc are not in sequence on the right-hand side of the output?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Reformatting file using Syncsort

Postby Marina Lozovatsky » Thu Dec 18, 2008 4:37 am

Thank you for reply, it could be in sequence order like this:
    PRO   00001  00003  AAA            CTR   00001  00001  AAA     
    PRO   00001  00001  BBB            CTR   00001  00002  BBB       
                                       CTR   00001  00001  CCC       

but PRO records on the left are not related to CTR records on the right.
Marina Lozovatsky
 
Posts: 2
Joined: Thu Dec 18, 2008 1:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Reformatting file using Syncsort

Postby Alissa Margulies » Thu Feb 05, 2009 3:12 am

Try the following SyncSort for z/OS job. I believe it will provide you with the desired results:
//S1    EXEC PGM=SORT                                             
//PRO     DD DISP=(,PASS),DSN=&&PRO,UNIT=SYSDA,SPACE=(TRK,1)     
//CTR     DD DISP=(,PASS),DSN=&&CTR,UNIT=SYSDA,SPACE=(TRK,1)     
//SYSOUT  DD SYSOUT=*                                         
//SORTIN  DD *                                             
PRO   00001  00001  AAA                                     
PRO   00001  00001  BBB                                     
PRO   00001  00001  AAA                                     
PRO   00001  00001  AAA                                     
                                     CTR   00001  00001  CCC
                                     CTR   00001  00001  BBB
                                     CTR   00001  00001  BBB
                                     CTR   00001  00001  AAA
//SYSIN   DD *                                           
   INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'PRO'),                 
   OVERLAY=(44:5C'0',51:5C'0')),                         
   IFTHEN=(WHEN=(38,3,CH,EQ,C'CTR'),                     
   OVERLAY=(14:5C'0'))                                   
   SORT FIELDS=(1,4,CH,A,21,4,CH,A,38,3,CH,A,58,3,CH,A)   
   DUPKEYS SUM=(14,5,ZD,44,5,ZD,51,5,ZD)                 
   OUTFIL FNAMES=PRO,INCLUDE=(1,3,CH,EQ,C'PRO'),         
   OUTREC=(1,24,SEQNUM,8,ZD)                             
   OUTFIL FNAMES=CTR,SAVE,OUTREC=(38,24,SEQNUM,8,ZD)     
//******************************************************
//S2     EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                 
//SORTOUT  DD SYSOUT=*                                 
//SORTJNF1 DD DISP=SHR,DSN=&&PRO                       
//SORTJNF2 DD DISP=SHR,DSN=&&CTR                       
//SYSIN    DD *                                         
  JOINKEYS FILE=F1,FIELDS=(25,8,A)                     
  JOINKEYS FILE=F2,FIELDS=(25,8,A)                     
  JOIN UNPAIRED                                         
  REFORMAT FIELDS=(F1:1,24,F2:1,24),FILL=X'40'         
  SORT FIELDS=COPY
  OUTREC BUILD=(1,24,38:25,24)     
/*                               

Here is the output produced from the above jobstream:
PRO   00001  00003  AAA              CTR   00001  00001  AAA
PRO   00001  00001  BBB              CTR   00002  00002  BBB
                                     CTR   00001  00001  CCC
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post