Page 2 of 2

Re: Compare multipe records in a single file

PostPosted: Wed Feb 26, 2014 8:41 pm
by ragsara
Hi Kolusu,

Yes we are sticking with 3 keys.

Re: Compare multipe records in a single file

PostPosted: Thu Feb 27, 2014 12:45 am
by skolusu
Use the following DFSORT JCL which will give you the desired results. I assumed that your input has RECFM=FB and LRECL=302. If you have different lrecl then make sure that you change M1F1CNTL to reflect the end position+1 where I am normalizing the free format key. Also change the positions in CTL2CNTL for JOINKEYS for F1.

Please get rid off the DCB parameters in your JCL as DFSORT can automatically calculate them for you.
//STEP0100 EXEC PGM=ICETOOL     
//TOOLMSG  DD SYSOUT=*           
//DFSMSG   DD SYSOUT=*           
//IN       DD DISP=SHR,DSN=Your Input FB 302 Byte file
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)       
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                   
  SELECT FROM(IN) TO(T1) ON(1,11,UFF) USING(CTL1) ALLDUPS         
  COPY JKFROM TO(OUT) USING(CTL2)                                 
//*                                                               
//CTL1CNTL DD *                                                   
  OPTION DYNALLOC=(SYSALLDA,50)                                   
                                                                 
  INREC BUILD=(003,11,          $ KEY                             
               198,35,          $ FNAME                           
               293,10)          $ DOB                             
                                                                 
  SORT FIELDS=(01,11,UFF,A,                                       
               12,35,CH,A,                                       
               47,10,CH,A)                                       
                                                                 
  SUM FIELDS=NONE                                                 
  OUTFIL FNAMES=T1,                                               
  IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,11),PUSH=(58:12,45))             
//*                                                               
//CTL2CNTL DD *                                                   
  OPTION DYNALLOC=(SYSALLDA,50)                                   
  JOINKEYS F1=IN,FIELDS=(303,11,A),TASKID=M1                     
  JOINKEYS F2=T1,FIELDS=(001,11,A),SORTED,NOSEQCK,TASKID=M1       
  REFORMAT FIELDS=(F1:1,302)                                     
//*                                               
//M1F1CNTL DD *                                                     
  INREC OVERLAY=(303:3,11,UFF,M11,LENGTH=11)                       
//*                                                                 
//M1F2CNTL DD *                                                     
  OMIT COND=((12,45,CH,EQ,58,45,CH),OR,                             
             ((12,35,CH,EQ,58,35,CH),AND,(47,10,CH,NE,93,10,CH)),OR,
             ((12,35,CH,NE,58,35,CH),AND,(47,10,CH,EQ,93,10,CH)))   
                                                                   
  INREC BUILD=(1,11,UFF,M11,LENGTH=11)                             
//* 

Re: Compare multipe records in a single file

PostPosted: Thu Feb 27, 2014 9:32 pm
by ragsara
Hi Kolusu,

I have just got one line to say for you "YOU ARE AWESOME".

It worked perfectly and am blessed to learn more such things from you.

I have commited few erorrs during this testing , hope you will forgive me.

Thank you and have a great day :)