Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Mon Jun 28, 2004 5:09 am Post subject:
Relaxing,
Try this. I assumed that your input file is 80 bytes and is of FB recfm.I also assumed that your exactly have 3 detail records. We first add a seqnum at the end. We generate a dynamic control card with startrec and endrec.
Thanks for the reply.
Unfortunately the detail lines are dynamic and not limited to 3. Is there a way to get the count (of record) for last occurance of the sequnce number? Then we can use this count.
Thanks a lot Kolusu..The result is great. I tried understanding the code but I cannot make much headway...
When you have the time could you please elaborate this..?
once we have the seqnum then using INCLUDE On OUTFIL , we are writting 2 files(C1 & C2). C1 to have the header seqnum and file c2 to have the footer seqnum.
If we wanted to select records from a particular record we use the startrec and endrec parms to select the desired records.
If you had to select the 001188 records we would have coded as follows
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Jun 28, 2004 10:47 am Post subject:
Here's another way of doing this with DFSORT usng Symbols:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(2,2)),DISP=(,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Add seqnum at end of record
INREC FIELDS=(1,80,81:SEQNUM,8,ZD)
* SORTIN->T1: Write records with seqnums
OUTFIL FNAMES=T1
* SORTIN->C1: * Generate DFSORT Symbols statements as follows:
* N1,+ssssssss
* N2,+eeeeeeee
* where ssssssss is the seqnum of the start record and
* eeeeeeee is the seqnum of the end record and
OUTFIL FNAMES=C1,
INCLUDE=((1,4,CH,EQ,C'HEAD',AND,6,6,CH,EQ,C'001188'),OR,
(1,4,CH,EQ,C'FOOT',AND,6,6,CH,EQ,C'001188')),
OUTREC=(C'N',SEQNUM,1,ZD,C',+',81,8,80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYMNAMES DD DSN=&&C1,DISP=(OLD,PASS)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
* Use generated N1 and N2 symbols to include needed records.
INCLUDE COND=(81,8,ZD,GE,N1,AND,81,8,ZD,LE,N2)
* Remove seqnum
OUTREC FIELDS=(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
DATENS=(4MD) is equivalent to DATE1 and TIMENS=(24) is equivalent to TIME1. _________________ 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
Can I make the changes in the existing header and footer record (without omitting and re-adding the records). This is because the existing header and trailer are 1600 length records containing some dynamic information like number of details lines etc. which I want to retain.
How do I insert an header and a trailer (input is only detail lines) for a record length 1600? I guess we cannot use SORT (the code you mentioned above) here.
I also need to include the complete record count in the trailer file.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Jul 05, 2004 9:08 am Post subject:
Relaxing,
DFSORT's HEADERx and TRAILERx parameters will create header and trailer records whose length match the length of the output LRECL. In the job below, if your input file has RECFM=FB and LRECL=1600, then the header, detail and trailer records will all be 1600 bytes. Notice that I've also included COUNT=(M11,LENGTH=6) in TRAILER1. This will place the count of the detail records in the trailer record. It will be 6 characters with leading zeros. You can use any form of COUNT=(edit) to edit the count into the format you like.
If your input records are not 1600 bytes long, but you want the output records to be 1600 bytes long, then you can use the OUTREC statement or OUTFIL OUTREC parameter to change the length of the input records to the length you want for the output records.
If you're unfamiliar with DFSORT/ICETOOL, I'd suggest you go through "DFSORT: Getting Started". It shows you, with examples, how to use the features of DFSORT, ICETOOL and DFSORT Symbols to do all kinds of things. You can access it online at:
_________________ 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