View previous topic :: View next topic
|
Author |
Message |
PurnaShankar
New User
Joined: 30 Dec 2008 Posts: 3 Location: bangalore
|
|
|
|
Hi
In a given input file with multiple header, detail and trailer records, I want to exclude the headers and trailers that doesnot have any detail records.
For Example, If Header record is identified by UHL1 and trailer record as UTL1, the input file is as below:
Code: |
UHL1ASdsdgs
UTL1sdrfgjsfj
UHL1sdfsdduk
478468dfhrlkio
357368sagvblwryhe
1335768asdklsasthjetj
UTL1asrhaeth
UHL1dejj
UTL1dfjmd |
The Output file should be as below:
Code: |
UHL1sdfsdduk
478468dfhrlkio
357368sagvblwryhe
1335768asdklsasthjetj
UTL1asrhaeth |
Can this be handled in Icetool or DFsort ?
Thanks,
Purna |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
well you could assign a sequence number, that always restarts at UHL1.
sort the file sequence number desc.
any UTL1 with a sequence of 2, means it and the following UHL1 need to be deleted.
the resort on sequence number ascending, and drop the sequence number. |
|
Back to top |
|
|
PurnaShankar
New User
Joined: 30 Dec 2008 Posts: 3 Location: bangalore
|
|
|
|
That sounds great. Could you please help me how we can generate the sequence number ? |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
PurnaShankar,
Assuming your input is FB,80. See if below helps...
Code: |
//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
UHL1ASDSDGS
UTL1SDRFGJSFJ
UHL1SDFSDDUK
478468DFHRLKIO
357368SAGVBLWRYHE
1335768ASDKLSASTHJETJ
UTL1ASRHAETH
UHL1SDFSDDUK
478468DFHRLKIO
1335768ASDKLSASTHJETJ
UTL1ASRHAETH
UHL1SDFSDDUK
1335768ASDKLSASTHJETJ
UTL1ASRHAETH
UHL1DEJJ
UTL1DFJMD
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(81,08,ZD) HIGHER(2) USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'UHL1'),
END=(1,4,CH,EQ,C'UTL1'),
PUSH=(81:ID=8))
OUTFIL FNAMES=OUT,BUILD=(1,80)
/* |
OUTPUT
Code: |
UHL1SDFSDDUK
478468DFHRLKIO
357368SAGVBLWRYHE
1335768ASDKLSASTHJETJ
UTL1ASRHAETH
UHL1SDFSDDUK
478468DFHRLKIO
1335768ASDKLSASTHJETJ
UTL1ASRHAETH
UHL1SDFSDDUK
1335768ASDKLSASTHJETJ
UTL1ASRHAETH |
Thanks, |
|
Back to top |
|
|
PurnaShankar
New User
Joined: 30 Dec 2008 Posts: 3 Location: bangalore
|
|
|
|
Thank you so much......
It works !!! |
|
Back to top |
|
|
|