|
View previous topic :: View next topic
|
| Author |
Message |
Yvonne1980
New User
Joined: 31 Aug 2010 Posts: 20 Location: Edinburgh
|
|
|
|
Hi,
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.
| Code: |
OMIT COND=((01,007,EQ,C'T######')),FORMAT=CH
SORT FIELDS=COPY
OUTFIL REMOVECC,
TRAILER1=('T######',
&DATENS=(4MD),
&TIMENS=(24),
22,8,
'NG',
'ASSETFIN',
COUNT=(M11,LENGTH=08),
TOT=(10,02,ZD,M11,LENGTH=20)) |
In the above example the
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 ?
Many thanks. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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. |
|
| Back to top |
|
 |
Yvonne1980
New User
Joined: 31 Aug 2010 Posts: 20 Location: Edinburgh
|
|
|
|
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
Input
| Code: |
AG060000021
AG130000011
AG130000011
AG140000051
AG140000051
A9660000011
A9660000011
T######20110928235827STRINGXY |
Output
| Code: |
AG060000021
AG130000011
AG130000011
AG140000051
AG140000051
A9660000011
A9660000011
T######20120201161732STRINGXYNGASSETFIN0000000800000000000000000167 |
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) |
|
| Back to top |
|
 |
Yvonne1980
New User
Joined: 31 Aug 2010 Posts: 20 Location: Edinburgh
|
|
|
|
Hi Frank,
I have updated the above post:
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
Input
| Code: |
AG060000021
AG130000011
AG130000011
AG140000051
AG140000051
A9660000011
A9660000011
T######20110928235827STRINGXY |
Output
| Code: |
AG060000021
AG130000011
AG130000011
AG140000051
AG140000051
A9660000011
A9660000011
T######20120201161732STRINGXYNGASSETFIN0000000700000000000000000167 |
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)
Thanks for your help. |
|
| Back to top |
|
 |
Skolusu
Senior Member
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
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input VB 5004 byte file,
// DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(5,7,CH,EQ,C'T######'),
OVERLAY=(12:DATE1,TIME1,34:C'NGASSETFIN',28X))
OUTFIL IFTRAIL=(TRLID=(5,7,CH,EQ,C'T######'),
TRLUPD=(44:COUNT=(M11,LENGTH=08),
TOT=(14,2,ZD,EDIT=(TTTTTTTTTTTTTTTTTTTT))))
//* |
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 |
|
 |
Yvonne1980
New User
Joined: 31 Aug 2010 Posts: 20 Location: Edinburgh
|
|
|
|
Hi Kolusu,
IFTRAIL, didn't know about that one.
Thanks for that wonderful piece of knowledge sharing. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|