Include row after a string



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

Include row after a string

Postby xcspg3 » Sun Jul 10, 2011 1:17 am

How include all lines after a row containing a string?
The row number of the row that contains the string is variable and I can't use "skiprec" and "stopaft".

The input is
aaa
bbb
ccc
ddd
xxx
eee
fff
ggg

The string is 'xxx'

The output should be
eee
fff
ggg

Thanks

max
xcspg3
 
Posts: 29
Joined: Tue Sep 25, 2007 6:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Include row after a string

Postby enrico-sorichetti » Sun Jul 10, 2011 6:18 pm

very quick and dirty, Frank or Kolusu might come up with something better

000004 //S1      EXEC PGM=SORT                                                 
000005 //SYSPRINT  DD SYSOUT=*                                                 
000006 //SYSOUT    DD SYSOUT=*                                                 
000007 //SORTIN    DD *                                                       
000008 AAA                                                                     
000009 BBB                                                                     
000010 CCC                                                                     
000011 XXX                                                                     
000012 EEE                                                                     
000013 FFF                                                                     
000014 GGG                                                                     
000015 HHH                                                                     
000016 III                                                                     
000017 //SORTOUT   DD SYSOUT=*,                                               
000018 //             DCB=(RECFM=FB,LRECL=80)                                 
000019 //SYSIN     DD *                                                       
000020   SORT   FIELDS=COPY                                                   
000021   INREC  IFTHEN=(WHEN=GROUP,BEGIN(1,3,CH,EQ,C'XXX'),                   
000022                  PUSH=(81:ID=1))                                       
000023   OUTFIL INCLUDE=(81,1,CH,EQ,C'1',AND,1,3,CH,NE,C'XXX'),BUILD=(1,80)   
000024 //*
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Include row after a string

Postby xcspg3 » Sun Jul 10, 2011 10:16 pm

Thanks a lot

max
xcspg3
 
Posts: 29
Joined: Tue Sep 25, 2007 6:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Include row after a string

Postby Frank Yaeger » Mon Jul 11, 2011 10:32 pm

Here's an easier way with DFSORT:

//S1 EXEC PGM=SORT                                                 
//SYSOUT DD SYSOUT=*                                               
//SORTIN DD *                                                       
aaa                                                                 
bbb                                                                 
ccc                                                                 
ddd                                                                 
xxx                                                                 
eee                                                                 
fff                                                                 
ggg                                                                 
//SORTOUT DD SYSOUT=*                                               
//SYSIN DD *                                                       
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=GROUP,END=(1,3,CH,EQ,C'xxx'),PUSH=(81:ID=1))   
  OUTFIL OMIT=(81,1,ZD,EQ,1)                                       
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Include row after a string

Postby xcspg3 » Fri Jul 15, 2011 4:32 pm

Thanks

max
xcspg3
 
Posts: 29
Joined: Tue Sep 25, 2007 6:34 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post