I want to create an output file from this input file where the rows need to be sorted after computing the average in case of Item_Desc occuring more than once. For items occuring only once, average quantity = quantity.
Basically, I want output for this case as follows :
AVG
specifies that an edited or converted average, for the values of a numeric input field in all data records of the report, is to appear in the report record. The average (or mean) is calculated by dividing the total by the count and rounding down to the nearest integer. For example:
I apologize for the clumsy representation of information.
However, gylbharat, can you please help me with a complete control card of the AVG computation you mentioned below. Please let me know if you need more information on the problem I posted.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
afroz.alam,
Your output does not match the specifications. You say you wanted to sort the records by descending average. so how did the PILLOW with an average of 80 (100+60 =160/2 =80) get sorted before SOFA with an average of 87.5 (75+100 =175/2 = 87.5) ?? I am guessing that they are typos. Here is DFSORT JCL which will give you the desired results.
Assumptions :
LRECL = 80
RECFM = FB
Item_Desc = 15 bytes starts at pos 1
Order_ID = 10 bytes starts at pos 16
Quantity = 05 bytes starts at pos 26 with leading zeroes supressed.
Use the same input file for both DD's INA and INB.
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
there was a thread just the other day, where someone was using syncsort with joinkeys. syncsort has other syntax or can't use jfn1cntl or refomat or something.
i use dfsort so didnot bother to remember,
but, looking thru posts for the last couple of days will provide the answer,
since the ts obviously does not feel compelled to consult a manual.