|
View previous topic :: View next topic
|
| Author |
Message |
ESSPRABHU
New User
Joined: 11 Oct 2005 Posts: 22
|
|
|
|
Hi,
I have to omit some records from my input file and need to update the record count(new count) in trailer record.
I will take care of records omission.
So please help me in updating the record count in the trailer record.
My file's RECFM =VB and LRECL=5063.
file has 'FFFF' at positon 1 for trailer record alone.
Trailer count should be 8 bype PD format.
I am copying portion of the trailer record in Hex format for reference.(from 60 - 80). Here the count is 38.
444444444444400000008
00000000000000000003C
Please let me know if you need further details.
Thanks,
Prabhu. |
|
| Back to top |
|
 |
muthuvel
Active User

Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Prabhu,
Does the count include the trailer record or is it just a count of the data records? That is, for your example are there 38 data records and a trailer record, or are there 37 data records and a trailer record?
Can the trailer record be rebuilt (e.g. it just has X'FFFF', blanks and the count) or is there something in the old trailer record that has to be kept for the new trailer record (what?). |
|
| Back to top |
|
 |
ESSPRABHU
New User
Joined: 11 Oct 2005 Posts: 22
|
|
|
|
Hi Frank,
In my file, one Header and one Trailer record will be there.
Count in the trailer record should be total detail record count. I.e excluding header and trailer.
Trailer is not required to re-build. Because old trailer needs to be copied as it is by updating the detail record count only. |
|
| Back to top |
|
 |
ESSPRABHU
New User
Joined: 11 Oct 2005 Posts: 22
|
|
|
|
Frank,
when I use the below code, I am getting count of all the records including Header and trailer.
SORT FIELDS=COPY
OUTREC IFOUTLEN=5063,
IFTHEN=(WHEN=INIT,OVERLAY=(5064:SEQNUM,8,PD,START=1)),
IFTHEN=(WHEN=(5,2,BI,EQ,X'FFFF'),OVERLAY=(77:5064,8))
but I need the count of Detail records only i.e excludig Header and Trailer.
Could you please advice.
Thanks,
Prabhu. |
|
| Back to top |
|
 |
notonly4u
New User
.jpg)
Joined: 26 Apr 2005 Posts: 87 Location: Hyderabad
|
|
|
|
What will be the value in 5,2 for detail records?
Regards
Tanden |
|
| Back to top |
|
 |
ESSPRABHU
New User
Joined: 11 Oct 2005 Posts: 22
|
|
|
|
Tanden,
The value in 5,2 for detail records will not be unique.
It will have alphanumeric data.
Thanks.... |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
ESSPRABHU,
Since your input is VB it is not a good idea to stick to the Seqnum at the end. We need to stick it right after the RDW and then later on remove it so that we preserve the original VB layout. Since you dont want the header and trailer to be part of the count , we subtract 2 from the seqnum which will give the count of just detail records
Adding the seqnum will push the data contents by 8 bytes
| Code: |
RDW |SEQNUM |13 |COUNT
1-4 |5-12 |DATA |85
|
Once we updated the count , then we remove the 8 bytes we added
| Code: |
RDW |5 |COUNT
1-4 |DATA |77
|
Use the following control cards
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,PD,5)),
IFTHEN=(WHEN=(13,2,CH,EQ,X'FFFF'),
OVERLAY=(85:5,8,PD,SUB,+2,PD,LENGTH=8))
OUTREC BUILD=(1,4,13)
//* |
|
|
| Back to top |
|
 |
ESSPRABHU
New User
Joined: 11 Oct 2005 Posts: 22
|
|
|
|
Hi Skolusu,
Thanks for your reply.
The code is working perfectly.
Thanks for your suggestion on Sequence number postion.
Prabhu... |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can now use DFSORT's new IFTRAIL function to do this more easily like this:
| 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=(HD=YES,TRLID=(5,2,BI,EQ,X'FFFF'),
TRLUPD=(77:COUNT=(TO=PD,LENGTH=8)))
/*
|
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 |
|
 |
|
|