We use the SORT statement to sort the left-aligned name values, and the amount1 values, in ascending order. The new function here is SFF.
We use the OUTREC statement to create the amount2 values from the amount1 and change values, and to right-align and add leading zeros to the id values. The OUTREC statement is processed after the SORT statement. The new functions here are OVERLAY, SFF, and UFF.
We use the first OUTFIL statement to create a report with the four fields nicely displayed in fixed positions, and with a trailer containing the averages for the amount1 and amount2 values. We also suppress the page eject that would normally appear for the trailer records. OUTFIL statements are processed after the OUTREC statement.
The new functions here are BLKCCT1 and SFF. Figure 4 shows the resulting output report.
We use the second OUTFIL statement to remove the plus signs from the amount1 and amount2 values, and to create the CSVs. The new functions here are BUILD and SQZ. Figure 5 shows the resulting CSV output records.
Refer to Figures 4 and 5 to see the output fields created by using the new functions.
Overlay Columns (OVERLAY)
OVERLAY is a new parameter you can use on the INREC, OUTREC and OUTFIL statements to change data in specific columns without affecting the rest of the record. OVERLAY also can be used to add fields at the end of each record. With OVERLAY, you can concentrate on just the fields of interest without rebuilding the entire record.
You can specify OVERLAY items in any order, change the same item multiple times, and overlap fields. Changes to earlier items affect changes to later items. This gives you great flexibility in what you can do with OVERLAY in a single INREC, OUTREC, or OUTFIL statement.