Hi All,
After a long time I am back to mainframe again.. :)
I got a requirement recently which I don’t know how to do that through sort parm. So need your help.
Here is the detail of the requirement:
1. We are matching two files based on a key, in a program and giving an o/p file which has the fields--> Key, Amount and the Indicator(Matched & Unmatched).
2. In the next step we are using Report Sort parm to generate a report. The requirements of that report are:
a. The TRAILER should have a Total field having the sum of all the amount for that key and an UNMATCHED Total field which should have the sum amount of unmatched records for that key.
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Welcome back
Please post the lrecl and recfm of the files.
Also, please post some sample input data and the otput you need when that input is processed. Show the field positions in the inputs and the output(s).
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
Please advice if there are way to do this.
I'm sure there's a way to do this with DFSORT, but in order to tell you how to do it I need you to give me more information for step 2 as follows:
(When I refer to "input file" below, I mean the output file from step 1 with the Key, Amount and the Indicator(Matched & Unmatched) which is the input file for step 2.)
What is the RECFM and LRECL of the input file?
What is the starting position, length and format of the following fields in the input file: Key, Amount, Indicator?
Please show an example of the record in the input file (relevant fields only) and what you expect the output to look like.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Well, your totals don't really seem to add up to what's in your data, but I think I get the idea. You can use a DFSORT job like the following. Just adjust everything for your actual input fields and expected output. The trick is to use IFTHEN to put 16-23 in 80-87 for the 'UM' records and PD 0's in 80-87 for the other records, and then do a TOT on 80-87 to get the total for the 'UM' records.