Joined: 13 Oct 2007
Location: Fort Worth, Tx USA
|I am running SYNCSORT FOR Z/OS 220.127.116.11R trying to do what I thought was going to be a piece of cake. Turns out today IS MONDAY and this is going downhill.
I have been reading Syncsort for Z/OS 1.3 Programmer's Guide for help but I just do not see how to do this.
My input records have three key fields that I call Major Key Field, Middle Key Field and Lower Key Field. Associated with each key field is a quantity. I simplified things by making my input file have the same Major Key Field Value on ALL input records.
If asll the record have a key of 123 and a quantity of 7, I want to print that qty on the Totals Line. I tried using TRAILER1 as shown below but apparently I cannot use EDIT on TRAILER1:
It is hard to tell above where the asterisk that denotes a syntax error goes. It is located below the comma prior to "PD".
Again, all records will have the same Major Key Value and the same associated major quantity on all the records. I want to print the quantity (not sum it and print it).
Next problem, the middle key field and the middle quantity. The input file can have one or more records with a given middle key value; every record with the same middle key will have the same value ion the middle quantity. I want to total the middle qty once per middle key value in the TOTALS Line. So, if the input file has 10 records with a middle key value of 123 and each one of those records has a quantity of 7, I only want the total to be 7 not 70. I tried several forms of TRAILER1 but got nowhere. How do I tell TRAILER1 to do this? Or do I do it some other way?
Summation of the third key & third quantity was normal summation and I had no problems with this. No question there. TRAILER1 worked fine and I am happy with the result.
If it helps, here is a sampling of records with keys/qtys as well as what I would want to see in the Totals Line:
MAIN KEY A, QTY=6, MIDDLE KEY = BB, QTY = 2, LOWER KEY=CCC, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = BB, QTY = 2, LOWER KEY=DDD, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = EE, QTY = 1, LOWER KEY=FFF, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = GG, QTY = 3, LOWER KEY=HHH, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = GG, QTY = 3, LOWER KEY=III, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = GG, QTY = 3, LOWER KEY=JJJ, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = KK, QTY = 0, LOWER KEY=LLL, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = KK, QTY = 0, LOWER KEY=MMM, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = KK, QTY = 0, LOWER KEY=NNN, QTY = 1
MAIN KEY A, QTY=6, MIDDLE KEY = PP, QTY = 0, LOWER KEY=NNN, QTY = 1
TOTALS: 6 6 10
Note: at this point, the Major Key Field Value for all the records is the same which is the reason that I am using TRAILER1 instead of something else. I do not need sub-totals for each different value of the Middle Key Fields.