Example: For an Outstanding Payments report, the packed-decimal Amount Due field on a company’s invoice records is converted to printable format and edited with a floating dollar sign, commas, and a decimal point. In addition, to make the output easy to read, ten blanks are inserted between the Company Name field and the Amount Due field. (The following figure gives the input record layout.)
To sort the records and accomplish the conversion and editing, the following is coded.
The following figure shows the effect of OUTREC processing on the input record.
Explanation: First the records are sorted alphabetically by Company Name (1,23,CH). Next, OUTREC processing inserts 10 blanks (10X) between the Company Name field (1,23) and the Balance Due field (24,4,PD). OUTREC processing also converts this packed-decimal field to printable format and edits it with the user-provided pattern specified on the EDIT subparameter, EDIT=($II,IIT.TT). This pattern provides for a floating dollar sign as well as the appropriate comma and decimal point. The Is indicate that leading zeros should not be printed and the Ts indicate that zeros in those positions should be printed. Note that this conversion and editing of the data cause the length of the Balance Due field to increase from its original length of four bytes to ten bytes.