|
|
| Author |
Message |
Kingshuk Roy
New User
Joined: 12 Dec 2007 Posts: 3 Location: Torrance
|
|
|
|
Hi,
I have an COBOL report with LRECL 133 in the following format.
The Headers can be identified with the word "ACCOUNT" starting at position 1.
The report-ID starts at position 9 and is of 7 bytes.
The Trailer can be identified as a sequence of 133 dashes('---------------')
ACCOUNT 1111111
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
ACCOUNT 2222222
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
ACCOUNT 1111111
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
ACCOUNT 4444444
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
The report IDs are not sorted in Arranging order and a report-ID can repeat at any place in the report any number of times.
In my example above, the Report-ID '1111111' is repeated twice at different positions.
I want to extract all header, Detail and Trailer records for a required Report-ID
For example, I want to extract the records for Report-ID 1111111
ACCOUNT 1111111
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
ACCOUNT 1111111
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
Is there any way to do it using ICETOOL. |
|
| Back to top |
|
 |
References
|
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 357 Location: San Jose
|
|
|
|
Kingshuk Roy,
The following DFSORT/ICETOOL JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=your input file,
// DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(134,8,CH) KEEPNODUPS WITHALL -
WITH(1,133) KEEPBASE USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,7,CH,EQ,C'ACCOUNT'),
OVERLAY=(134:SEQNUM,8,ZD,9,7)),
IFTHEN=(WHEN=NONE,OVERLAY=(142:SEQNUM,8,ZD,
134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))
SORT FIELDS=COPY
OUTFIL FNAMES=OUT,BUILD=(1,133),
INCLUDE=(142,7,CH,EQ,C'1111111')
/* |
Hope this helps...
Cheers |
|
| Back to top |
|
 |
Kingshuk Roy
New User
Joined: 12 Dec 2007 Posts: 3 Location: Torrance
|
|
|
|
Hi Skolusu
This is not working. I am getting an Error.
I am putting down the error message here.
END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,SOR*
TOUT=OUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,NOCH*
ECK
SORT FIELDS=(134,8,CH,A)
MODS E35=(ICE35DU,12288)
RECORD TYPE IS F - DATA STARTS IN POSITION 1
END OF FIELD BEYOND MAXIMUM RECORD LENGTH
END OF DFSORT
Look at the BOLD portion above. I think that I need to move the output into an temp variable first and then into the OUT dataset. |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 357 Location: San Jose
|
|
|
|
Kingshuk Roy,
I need to see your complete DFSMSG messages. However I am guessing that you don't have the latest PTF which supports INREC processing with SPLICE. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006). If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free).
One way to verify that you have the PTF is
Look at the ICE201I message in DFSMSG . If you see a zero then your version does not support INREC processing with splice.
| Quote: |
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1
|
If you have the latest PTF then the message would have an E
| Quote: |
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
|
if you don't have the latest PTF then use the following DFSORT JCL
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=your input file,
// DISP=SHR
//T1 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SPLICE FROM(T1) TO(OUT) ON(134,8,CH) KEEPNODUPS WITHALL -
WITH(1,133) KEEPBASE USING(CTL2)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,7,CH,EQ,C'ACCOUNT'),
OVERLAY=(134:SEQNUM,8,ZD,9,7)),
IFTHEN=(WHEN=NONE,OVERLAY=(142:SEQNUM,8,ZD,
134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))
OUTFIL FNAMES=T1
//CTL2CNTL DD *
SORT FIELDS=COPY
OUTFIL FNAMES=OUT,BUILD=(1,133),
INCLUDE=(142,7,CH,EQ,C'1111111')
/*
|
Hope this helps....
Cheers |
|
| Back to top |
|
 |
Kingshuk Roy
New User
Joined: 12 Dec 2007 Posts: 3 Location: Torrance
|
|
|
|
Hi Skolusu,
Thanks a lot. Your Solution is working perfectly. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4613 Location: San Jose, CA
|
|
|
|
You can do this kind of thing more easily and efficiently with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/133)
//SORTOUT DD DSN=... output file (FB/133)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,7,CH,EQ,C'ACCOUNT'),
PUSH=(134:9,7))
OUTFIL INCLUDE=(134,7,CH,EQ,C'1111111'),BUILD=(1,133)
/*
|
For complete details on the WHEN=GROUP function and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/ |
|
| Back to top |
|
 |
|
|
|