Subtotaling Data at the End of a Page - mfx - 3.1

Syncsort™ MFX Programmers Guide

Product type
Software
Portfolio
Integrate
Product family
Syncsort™ Software
Product
Syncsort™ MFX > MFX
Version
3.1
Language
English
Content type
Programmer’s Guide
Product name
Syncsort™ MFX
Title
Syncsort™ MFX Programmers Guide
Copyright
2024
First publish date
2010
Last updated
2024-11-06
Published on
2024-11-06T17:38:26.716054

Example: The page trailer for a report listing invoices is to contain the totals for the Amount Paid and the Balance Due fields of the invoice records printed up to and including that page. These totals will appear directly below the columns of figures and be separated from them by strings of hyphens. An identifying label, TOTALS:, will appear on the same line as the totals and will begin in column 40.

To generate the trailer, the following is coded.
Figure 1. JCL and Required Control Statements

The following figure shows the trailer that is produced.

Figure 2. TRAILER2 with SUBTOTAL

Explanation: The above TRAILER2 provides for totaling the figures in the Amount Paid field (46,4,PD) and the Amount Due field (54,4,PD) on the invoice records. Because the SUB (SUBTOTAL) entry is specified, the totals that appear at the bottom of each page represent running totals, that is, the totals for all the records that have been printed up to and including that page. The TRAILER2 also generates the identifying label TOTALS: (40:'TOTALS:') and strings of hyphens at the bottoms of the columns to be totaled (65:10'-', 86:10'-').

The totaled data for each field is converted to printable format and, after being edited, begins printing in the columns specified with the two number colon entries (c:), 65: and 86:. The data is edited by the EDIT pattern, ($II,IIT.TT), which suppresses the printing of leading zeros and inserts a floating dollar sign as well as the necessary comma and decimal point. The pattern uses an I to indicate the zeros in the total that should not be printed and a T to indicate those that should.