Extract selected portion based on certain conditions



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

Extract selected portion based on certain conditions

Postby dev.. » Mon Mar 29, 2010 11:22 pm

I have a requirement as follows

Input Data
66666 GHFAFSG........
11111 MXTRYRT..........
22222 NNFGHM...........
44444 L....................
33333 ORTHRTHJJ........
66666 R....
77777 S..
11111 T..
33333 G...
55555 W....
88888 R..
11111 D..
66666 S..
77777 A..
33333 B..

I will start extracting weherever i f will ger 11111 and will stop at 33333 ,i.e
My Output will be as follows

11111 MXTRYRT..........
22222 NNFGHM...........
44444 L....................
33333 ORTHRTHJJ........
11111 T..
33333 G...
11111 D..
66666 S..
77777 A..
33333 B..


How can SORT/ICETOOL/FILE-AID BATCH/Any other utlity(Without any program) helps
dev..
 
Posts: 2
Joined: Mon Mar 29, 2010 10:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Extract selected portion based on certain conditions

Postby Frank Yaeger » Tue Mar 30, 2010 4:59 am

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
66666 GHFAFSG........
11111 MXTRYRT..........
22222 NNFGHM...........
44444 L....................
33333 ORTHRTHJJ........
66666 R....
77777 S..
11111 T..
33333 G...
55555 W....
88888 R..
11111 D..
66666 S..
77777 A..
33333 B..
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'11111'),
    END=(1,5,CH,EQ,C'33333'),PUSH=(81:ID=1))
  OUTFIL INCLUDE=(81,1,CH,NE,C' '),BUILD=(1,80)
/*
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: Extract selected portion based on certain conditions

Postby dev.. » Wed Apr 07, 2010 8:11 pm

Thanks..it works fine...however in my actual requirement,data will be as follows



....66666 GHFAFSG........
........ 11111 MXTRYRT..........
....22222 NNFGHM...........
......44444 L....................
........33333 ORTHRTHJJ.........
......66666 R....
...77777 S..
.....11111 T..
.......33333 G...
....55555 W....
....88888 R..
......11111 D..
....66666 S..
...77777 A..
.....33333 B..


i.e, that 11111,2222 value may appear in any position within 1 to 80 field(fb)..
Can yor sort card be modified to capture my requirement
dev..
 
Posts: 2
Joined: Mon Mar 29, 2010 10:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Extract selected portion based on certain conditions

Postby Frank Yaeger » Wed Apr 07, 2010 9:37 pm

Just change the DFSORT control statements to:

  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,80,SS,EQ,C'11111'),             
    END=(1,80,SS,EQ,C'33333'),PUSH=(81:ID=1))                       
  OUTFIL INCLUDE=(81,1,CH,NE,C' '),BUILD=(1,80)                     
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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post