Page 1 of 1

Repeating groups with specific records

PostPosted: Fri Feb 17, 2012 2:19 pm
by whowillwait4u
Hi,

I have the following records in input file:

Keka
subbu
naresh
naveen

naveen
subbu
subbu
subbu
jaffa
naveen
subbu
katrina
naresh
naveen
subbu
naresh
naveen

jakia

i want the output file having only groups starting with 'subbu' ending with 'naveen' and in between only single 'naresh'.

subbu
naresh
naveen
subbu
naresh
naveen

could you please help?!

Re: Repeating groups with specific records

PostPosted: Fri Feb 17, 2012 11:01 pm
by skolusu
whowillwait4u,

use the following DFSORT/ICETOOL JCL which will give you the desired results
//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD *                                                   
KEKA                                                               
SUBBU                                                             
NARESH                                                             
NAVEEN                                                             
NAVEEN                                                             
SUBBU                                                             
SUBBU                                                             
SUBBU                                                             
JAFFA                                                             
NAVEEN                                                             
SUBBU                                                             
KATRINA                                                           
NARESH                                                             
NAVEEN                                                             
SUBBU                                                             
NARESH                                                             
NAVEEN                                                             
JAKIA                                                             
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  SELECT FROM(IN) TO(OUT) ON(81,16,CH) ALLDUPS USING(CTL1)         
//CTL1CNTL DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'SUBBU'),             
     END=(1,6,CH,EQ,C'NAVEEN'),PUSH=(81:ID=8,SEQ=8)),             
  IFTHEN=(WHEN=(1,6,CH,EQ,C'NARESH'),                             
  OVERLAY=(89:+1,SUB,89,8,ZD,M11,LENGTH=8)),                       
  IFTHEN=(WHEN=(1,6,CH,EQ,C'NAVEEN'),                             
  OVERLAY=(89:+2,SUB,89,8,ZD,M11,LENGTH=8))                       
  OUTFIL BUILD=(1,80),                                             
  INCLUDE=(1,6,SS,EQ,C'SUBBU ,NAVEEN,NARESH',AND,89,8,ZD,EQ,1)     
//*

Re: Repeating groups with specific records

PostPosted: Sat Feb 18, 2012 10:55 am
by whowillwait4u
Thats brilliant!..i understood the logic. i was unaware of doing Arithmetic with OVERLAY. Thank you very much Kolusu! i appriciate your help.