|
View previous topic :: View next topic
|
| Author |
Message |
Muthukumar.PLindia
New User

Joined: 03 Jul 2006 Posts: 51 Location: Chennai
|
|
|
|
Please help me out in coding this in a single sort step...
Input file:
----------
Header record
data
Trailer ( actually trailer holds the count of data records and sum of an amount filed in the record)
my requirement is to filter the data records based on condition and update the trailer record with the updated count and summed values of the amount in trailer record.
first digit wil indicate the type of record(header, trailer, data)
output file should be like:
header record
data record(filetered)
Trailer(with modified counts and sum)
I have to complete this in a single step... |
|
| Back to top |
|
 |
Muthukumar.PLindia
New User

Joined: 03 Jul 2006 Posts: 51 Location: Chennai
|
|
|
|
Example:
Input file
------------
H header
D key1 0100
D key2 0200
D key1 0300
T 3 0600 ( 3 is the count of record and 600 is the total sum of amt)
Sort(filters key1 alone)
output file:
-----------
H header
D key1 0100
D key1 0300
T 2 0400 |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
H header
D key1 0100
D key2 0200
D key1 0300
T 3 0600
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OMIT COND=(1,1,CH,EQ,C'T',OR,
(1,1,CH,EQ,C'D',AND,3,4,CH,NE,C'key1'))
OUTFIL REMOVECC,
TRAILER1=(1:'T',3:COUNT-1=(EDIT=(IT)),
13:TOT=(10,4,ZD,EDIT=(TTTT)))
/*
|
|
|
| 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 *
H header
D key1 0100
D key2 0200
D key1 0300
T 3 0600
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL INCLUDE=(3,4,CH,EQ,C'key1'),
IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),
TRLUPD=(3:COUNT=(EDIT=(IT)),
13:TOT=(10,4,ZD,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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|