Reformat multiple records into single with occurences????



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

Reformat multiple records into single with occurences????

Postby rmd3003 » Thu May 23, 2013 10:45 pm

Hello there. I was curious if it's possible to reformat multiple records with the same key into single one using ICETOOL?
Input file has multiple records with the same key (they can change). No more than 25 records per key.

Output file will have single record per key with occurences (25)

I also need to populate counter on record on output record in position 15

Input file:
-
---+----1----+----2----+----3----+----4----+----5
AAAA00001         R01X001                       
AAAA00001         R01X002                       
AAAA00222         R02X001                       
AAAA00222         R02X002                       
AAAA00222         R02X003                       
AAAA33333         R03X001                       
AAAA33333         R03X002                       
AAAA33333         R03X003                       
AAAA33333         R03X004                       
AAAA33333         R03X005   


Output file will be like this:
Counter is highlighted in yellow.
---+----1----+----2----+----3----+----4----+----5----+--
AAAAA00001   002  R01X001 R01X002                       
AAAAA00222   003  R02X001 R02X002 R02X003               
AAAAA33333   005  R03X001 R03X002 R03X003 R03X004 R03X004


If it's possible maybe somebody has similar code to show me.
Thank you very much in advance.....

BTW - SYNCSORT FOR Z/OS 1.4.0.1R
rmd3003
 
Posts: 6
Joined: Wed Nov 23, 2011 1:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Reformat multiple records into single with occurences???

Postby BillyBoyo » Fri May 24, 2013 5:11 am

Well, there is a similar question today in the DFSORT forum on the Sister site, http://ibmmainframes.com You'll need to use SPLICE with several IFTHENs (25 at least to arrange the data, perhaps a few more to do the count).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Reformat multiple records into single with occurences???

Postby Thampy » Sat May 25, 2013 4:27 pm

Please find below the Syncsort JCL for the single record per key with occurences (5). You can modify the jcl to add another 20 IFTHEN's to suit your requirement
The OUTFIL statement has to be modfied to the record length you are looking for

//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAA00001 R01X001
AAAA00001 R01X002
AAAA00222 R02X001
AAAA00222 R02X002
AAAA00222 R02X003
AAAA33333 R03X001
AAAA33333 R03X002
AAAA33333 R03X003
AAAA33333 R03X004
AAAA33333 R03X005
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(15:C'001',28:8Z,36:8Z,
44:8Z,52:8Z,
300:SEQNUM,3,ZD,RESTART=(1,9))),
IFTHEN=(WHEN=(300,3,ZD,EQ,2),OVERLAY=(28:20,8,20:8Z)),
IFTHEN=(WHEN=(300,3,ZD,EQ,3),OVERLAY=(36:20,8,20:8Z)),
IFTHEN=(WHEN=(300,3,ZD,EQ,4),OVERLAY=(44:20,8,20:8Z)),
IFTHEN=(WHEN=(300,3,ZD,EQ,5),OVERLAY=(52:20,8,20:8Z))
SORT FIELDS=(1,9,CH,A)
SUM FIELDS=(15,3,ZD,20,8,BI,28,8,BI,36,8,BI,44,8,BI,
52,8,BI)
OUTREC FINDREP=(IN=X'00',OUT=X'40')
OUTFIL BUILD=(1,80)


Sample Output
AAAA00001 002 R01X001 R01X002
AAAA00222 003 R02X001 R02X002 R02X003
AAAA33333 005 R03X001 R03X002 R03X003 R03X004 R03X005
Thampy
 
Posts: 36
Joined: Sat Sep 26, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 3 times

Re: Reformat multiple records into single with occurences???

Postby NicC » Sun May 26, 2013 8:02 pm

As IFTHEN is a sort control keyword modifying the JCL is impossible as it does not have IFTHEN. Presumably you meant modify the sort control cards.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Reformat multiple records into single with occurences???

Postby rmd3003 » Tue May 28, 2013 8:07 pm

Thanks everybody.
rmd3003
 
Posts: 6
Joined: Wed Nov 23, 2011 1:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Reformat multiple records into single with occurences???

Postby Thampy » Wed May 29, 2013 12:45 am

I meant modify the SORT control cards to add 20 IFTHEN's. Sorry for the confusion caused.
Thampy
 
Posts: 36
Joined: Sat Sep 26, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 3 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post