View previous topic :: View next topic
|
Author |
Message |
naveengec
New User
Joined: 24 Mar 2007 Posts: 35 Location: pune
|
|
|
|
Hi,
I am trying to include the record count including trailer record thru SORT with the below code.
Code: |
SORT FIELDS=COPY
OUTFIL REMOVECC,TRAILER1=(1:C'ZZZ',COUNT=(M11,LENGTH=8))
|
This is giving a cound of records except the trailer record. PLease let me know how to include trailer record in the total count. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Use COUNT+1 |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Code: |
SORT FIELDS=COPY
OUTFIL REMOVECC,TRAILER1=(1:C'ZZZ',COUNT+1=(M11,LENGTH=8))
|
|
|
Back to top |
|
|
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
Hi,
In addition to the above I have one question. Can we overwite the trailer count in the same file?
Ex:
File 1
HDR0001
DTL0002
DTL0003
TLR0006
In this count of all records in trailer is appearing as wrong (0006), I need to count the records and put the correct count at same position & in same file.
I know this can be done by seperating the trailer and then merging it, but just a thought can we overwrite the count using OVERLAY or some other function?
Thanks |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Sandy, Below code will give you required.
(assuming LRECL is 80)
Code: |
//S1 EXEC PGM=SORT
//SORTIN DD *
HDR0001
DTL0002
DTL0003
TLR0006
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'TLR'),OVERLAY=(4:81,4))
OUTFIL BUILD=(1,80)
/*
|
|
|
Back to top |
|
|
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
Thanks..
This is working...one more on top of this can we do same for VB format? I have tried but it's not overwrtting the trailer, its giving me error for RDW though I have used correct sort card.. I have tried by converting the VB fomat to FB, overwrite the count in TLR & then again converting FB into VB. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
This is working...one more on top of this can we do same for VB format? I have tried but it's not overwrtting the trailer, its giving me error for RDW |
Tell us what error you are getting.
Show us the sortcard you are using.
Without you, tellling this is its not possible to say where you are going wrong. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
its giving me error for RDW though I have used correct sort card.. |
Sorry but correct sort cards do not generate errors. . .
To get help you need to do as Sambhaji said - show what you used and the exact error(s) generated. |
|
Back to top |
|
|
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
Here is the sort card -
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'TLR'),OVERLAY=(10:81,4))
OUTFIL BUILD=(1,80), VLFILL=X'40'
/*
Trailer count starts at position 10. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
And where is the error that was generated?
You need to copy/paste the exact error(s) (including message ids) from the diagnostic output. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Help-Me-Out,
For a VB file, you'd want to put the sequence number between the RDW and the first byte of data, not at the end of the record.
Quote: |
Trailer count starts at position 10. |
I don't know if you mean it starts at position 10 including the RDW or not including the RDW, so I'll show you an example where the trailer count starts at position 5 including the RDW and hopefully you can figure it out from that.
If the input records look like this:
Code: |
Len|Data
14 HDR0001ABC
15 DTL0002DEFG
13 DTL0003HI
14 TLR0006JKL
|
and you want the output records to look like this:
Code: |
Len|Data
14 HDR0001ABC
15 DTL0002DEFG
13 DTL0003HI
14 TLR0004JKL
|
you can use this DFSORT job:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB)
//SORTOUT DD DSN=... output file (VB)
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:SEQNUM,4,ZD,9:5)),
IFTHEN=(WHEN=(9,3,CH,EQ,C'TLR'),BUILD=(1,4,9,3,5,4,16)),
IFTHEN=(WHEN=NONE,BUILD=(1,4,5:9))
/*
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If you have z/OS DFSORT V1R10 PTF UK90025 or z/OS V1R12 PTF UK90026 (Oct, 2010), you can use the new IFTRAIL function to update the trailer record more easily:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB)
//SORTOUT DD DSN=... output file (VB)
//SYSIN DD *
OPTION COPY
OUTFIL IFTRAIL=(TRLID=(5,3,CH,EQ,C'TLR'),
TRLUPD=(8:COUNT+1=(EDIT=(TTTT))))
/*
|
For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242 |
|
Back to top |
|
|
|