Joined: 25 Mar 2007 Posts: 11 Topics: 4 Location: Switzerland
Posted: Mon Dec 14, 2009 12:33 pm Post subject: Select only the first group of records
Hi,
I search a trick to extract (only) the first group of records in a file. The not selected should be saved in a separate output data set.
The input file has no headers or trailers. The group-key has a length from 10 characters.
I found only solutions with the "GROUP=" clausel. But here i need a header-record.
All files have following format:
RECFM=FB, LRECL=80
Example (input file):
Code:
Daniel
Daniel
Daniel
Max
Max
Max
Max
Tommy
Tommy
Rita
Rita
James
James
James
Desired output file 1:
Code:
Daniel
Daniel
Daniel
Desired output file 2:
Code:
Max
Max
Max
Max
Tommy
Tommy
Rita
Rita
James
James
James
Is this possible with dfsort or icetool?
thank you in advance
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Dec 14, 2009 5:35 pm Post subject:
You can use a DFSORT job like the following to do what you asked for:
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
Daniel
Daniel
Daniel
Max
Max
Max
Max
Tommy
Tommy
Rita
Rita
James
James
James
/*
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,10))),
IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(81:ID=8))
OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum