I have a below sort step in my JCL where we roll up the quantity and eliminating the spaces between each columns. Rolling up the quantity was working good until i added the line OUTFIL FINDREP=(IN=C' ',OUT=C''). After I added the above line, the space was eliminated but the adding quantity value was wrong. Is anybody is having any ideas? Here I am sending sample input values and expected output.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
The SUM has already happened before the OUTFIL, so the OUTFIL is not affecting the SUM in any way (there will be no spaces in the SUMmed field, so nothing to change).
Putting your stuff in the Code tags, it seems your input records are not in fixed positions. Is that an error in posting, or is your file like that? If like that, maybe (we can't see the entire record) what you think is going to SUM is not matching on the key?
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Seems like TS might just have had bad data going in.
Remember that every byte added in INREC where there is a SORT makes more data which makes the sort slower. The extent to which this "matters" depends on the number of records, but it is generally good practice to sort less data rather than more.
If the data for sorting are in fixed positions on the input, there is no real point in just making them variable in position and making a fixed key for the sort at the end of the record. Although it would work. But there are many convoluted ways of doing things in any language that "work" but which would not be recommended.
I think as well as achieving the task, try with the minimum of changing the data.