I'm trying to copy a file and rebuild the trailer record.
I want to add some fixed text, copy position 22 for 8 from the original trailer and recalculate the count and total on a specific column. Here's what I have so far.
just creates 8 spaces because I do not know how to tell it to pick these chars up from the original trailer, especially as I am omitting the original trailer.
I have tried to use the BUILD function but it does not appear to allow the COUNT and TOT functions.
Does anyone know how to rebuild a trailer record with TOT and COUNT while also picking up some info from the original trailer ?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You need to give more details before I can help you.
Please show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file.
Here's a little made up input and output file, both files will be VB 5004. A trailer is identified by 01,007,EQ,C'T######' the column to be totalled is TOT=(10,02,ZD,M11,LENGTH=20), the field I want to pick up from the original trailer is char data starting in pos 22 for 8
New Trailer
1. char string 'T#######'
2. Date: YYYYMMDD
3. Time: HHMMSS
4. 8 chars from original trailer in char format starting in pos 22 for 8.
5. Char string: 'NG',
6. Char string: 'ASSETFIN',
7. Record count: COUNT=(M11,LENGTH=08),
8. The sum of col 10 for 2 TOT=(10,02,ZD,M11,LENGTH=20)
Here's a little made up input and output file, both files will be VB 5004. A trailer is identified by 01,007,EQ,C'T######' the column to be totalled is TOT=(10,02,ZD,M11,LENGTH=20), the field I want to pick up from the original trailer is char data starting in pos 22 for 8
New Trailer layout
1. char string 'T#######'
2. Sys Date: YYYYMMDD
3. Sys Time: HHMMSS
4. 8 chars from original trailer in char format starting in pos 22 for 8.
5. Char string: 'NG',
6. Char string: 'ASSETFIN',
7. Next 8 bytes contains the Record count: COUNT=(M11,LENGTH=08),
8. Next 20 bytes contains The sum of col 10 for 2 TOT=(10,02,ZD,M11,LENGTH=20)
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Yvonne1980,
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 update the trailer record like shown below