Removing Block of records using SORT
Posted: Fri Mar 11, 2016 1:13 pm
Hi Team,
I have the input as mentioned below with LRECL as 430.
I am looking for an output as mentioned below.
I have tried below mentioned SYSIN but seems to be deleting only occurrence of 3112.
Output that I have got is as mentioned below.
Please correct me. Thanks in advance.
I have the input as mentioned below with LRECL as 430.
3111 252700 HEAD
3112 X1
3112 X2
3112 X3
3111 252800 HEAD
3112 Y1
3112 Y2
3112 Y3
3112 X1
3112 X2
3112 X3
3111 252800 HEAD
3112 Y1
3112 Y2
3112 Y3
I am looking for an output as mentioned below.
3111 252800 HEAD
3112 Y1
3112 Y2
3112 Y3
3112 Y1
3112 Y2
3112 Y3
I have tried below mentioned SYSIN but seems to be deleting only occurrence of 3112.
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=((1,3,PD,EQ,03111),
AND,(30,6,PD,EQ,00000252700)),
END=(1,3,PD,EQ,03112),PUSH=(431:ID=1),HIT=NEXT)
OUTFIL OMIT=(431,1,CH,NE,C' '),BUILD=(1,430)
/*
OPTION COPY
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=((1,3,PD,EQ,03111),
AND,(30,6,PD,EQ,00000252700)),
END=(1,3,PD,EQ,03112),PUSH=(431:ID=1),HIT=NEXT)
OUTFIL OMIT=(431,1,CH,NE,C' '),BUILD=(1,430)
/*
Output that I have got is as mentioned below.
3112 X2
3112 X3
3111 252800 HEAD
3112 Y1
3112 Y2
3112 Y3
3112 X3
3111 252800 HEAD
3112 Y1
3112 Y2
3112 Y3
Please correct me. Thanks in advance.