Page 1 of 1

Many to Many Record Splicing using Icetool

PostPosted: Tue Dec 27, 2011 2:26 pm
by Eswarbabu
Hi,

We can employ splice command to successfully perfom one-to-many record splicing.

My requirement is, i have two records (represented here as 'A') which are to be spliced with 'n' records (represented here as 'B' )based on 'dayname' as matching condition.

(say)

A:

20111227..........SUN
20111228..........MON

B:

........YYYYYYYYYYSUN
........XXXXXXXXXXSUN
........2222222222MON
........3333333333MON

My end result should look like...

20111227YYYYYYYYYYSUN
20111228XXXXXXXXXXSUN
201112282222222222MON
201112283333333333MON

Re: Many to Many Record Splicing using Icetool

PostPosted: Tue Dec 27, 2011 4:12 pm
by Eswarbabu
Sorry, please find the proper example

(say)

A:

20111225..........SUN
20120101..........SUN

20111226..........MON
20120102..........MON


B:

........YYYYYYYYYYSUN
........XXXXXXXXXXSUN
........2222222222MON
........3333333333MON

My end result should look like...

20111225YYYYYYYYYYSUN
20111225XXXXXXXXXXSUN

20120101YYYYYYYYYYSUN
20120101XXXXXXXXXXSUN

201112262222222222MON
201112263333333333MON

201201022222222222MON
201201023333333333MON

Re: Many to Many Record Splicing using Icetool

PostPosted: Tue Dec 27, 2011 11:20 pm
by skolusu
Use the following DFSORT JCL which will give you the desired results. I assumed that your output lrecl is 80

//STEP0100 EXEC PGM=SORT               
//SYSOUT   DD SYSOUT=*                 
//INA      DD *                         
----+----1----+----2----+----3----+----4
20111225..........SUN                   
20120101..........SUN                   
20111226..........MON                   
20120102..........MON                   
//INB      DD *                         
........YYYYYYYYYYSUN                   
........XXXXXXXXXXSUN                   
........2222222222MON                   
........3333333333MON                   
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                         
  JOINKEYS F1=INA,FIELDS=(19,3,A)       
  JOINKEYS F2=INB,FIELDS=(19,3,A)       
  REFORMAT FIELDS=(F1:1,8,F2:9,10,19,62)
  OPTION COPY                           
//*