Removing Block of records using SORT



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Removing Block of records using SORT

Postby Papya013 » Fri Mar 11, 2016 1:13 pm

Hi Team,

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


I am looking for an output as mentioned below.

3111 252800 HEAD
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)                    
/*    


Output that I have got is as mentioned below.

3112 X2
3112 X3
3111 252800 HEAD
3112 Y1
3112 Y2
3112 Y3


Please correct me. Thanks in advance.
Papya013
 
Posts: 35
Joined: Wed Nov 06, 2013 6:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Removing Block of records using SORT

Postby NicC » Fri Mar 11, 2016 1:50 pm

What is wrong with posting in the correct part of the forum? Topic moved.
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: Removing Block of records using SORT

Postby BillyBoyo » Fri Mar 11, 2016 3:15 pm

Your END is true for the first 3112, so that is what happens.

You need a limit for the group. If this is for a once-off, then make the END more specific or use RECORDS= to specify the exact number in the group.

For multiple runs, I'd code then END as like the BEGIN except the second condition reversed. Not that this will include the second header in the first group, so you'll need to cater for that.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Removing Block of records using SORT

Postby Papya013 » Fri Mar 11, 2016 3:24 pm

Hi, Thanks for your input.

But the records in the group may vary so RECORDS = nnn can't be used.

can you please show the syntax of putting this in place.
"I'd code then END as like the BEGIN except the second condition reversed. Not that this will include the second header in the first group, so you'll need to cater for that."
Papya013
 
Posts: 35
Joined: Wed Nov 06, 2013 6:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Removing Block of records using SORT

Postby BillyBoyo » Fri Mar 11, 2016 4:24 pm

//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,03111),AND,(30,6,PD,NE,00000252700)),PUSH=(431:ID=1)),
       IFTHEN=(WHEN=((1,3,PD,EQ,03111),AND,(30,6,PD,NE,00000252700)),
              OVERLAY=(431:C' '))                  
     OUTFIL OMIT=(431,1,CH,NE,C' '),BUILD=(1,430)                    
/*    


Something like that, untested and thought about only superficially.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Removing Block of records using SORT

Postby Papya013 » Fri Mar 11, 2016 4:52 pm

Excellent and Thanks a lot. Its working as expected.
Papya013
 
Posts: 35
Joined: Wed Nov 06, 2013 6:53 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post