View previous topic :: View next topic
|
Author |
Message |
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
PTF Level, ICE020I = H
I have an input file as shown below, RECFM=FB, LRECL=40, and what I want to do is to select records from only GRP2 and propogate the GRP and NAME from the first record in each subset of records down to all the other records in the subset, as shown in the desired output.
I've read through the DFSORT smart tricks document and user guide, and will gladly admit that I know very little about the functionality of DFSORT / ICETOOL other than the basics.
Anyone have any ideas on how to achieve this.
Input data
Code: |
GRP1 NAME1 DATE1
DATE2
GRP1 NAME2 DATE1
GRP1 NAME3 DATE1
DATE2
DATE3
GRP2 NAME1 DATE1
DATE2
GRP2 NAME2 DATE1
DATE2
DATE3
DATE4
GRP3 NAME1 DATE1
DATE2
GRP3 NAME2 DATE1 |
Required output
Code: |
GRP2 NAME1 DATE1
GRP2 NAME1 DATE2
GRP2 NAME2 DATE1
GRP2 NAME2 DATE2
GRP2 NAME2 DATE3
GRP2 NAME2 DATE4 |
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
expat,
It is quite easy, all you need to do is use WHEN=GROUP. Use the following DFSORT JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----
GRP1 NAME1 DATE1
DATE2
GRP1 NAME2 DATE1
GRP1 NAME3 DATE1
DATE2
DATE3
GRP2 NAME1 DATE1
DATE2
GRP2 NAME2 DATE1
DATE2
DATE3
DATE4
GRP3 NAME1 DATE1
DATE2
GRP3 NAME2 DATE1
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,NE,C' '),PUSH=(1:1,10))
OUTFIL INCLUDE=(1,4,CH,EQ,C'GRP2')
//* |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Thanks Kolusu,
I was sort of going in the right direction by using INREC. Many thanks for the solution. |
|
Back to top |
|
|
|