Example: For an outstanding invoices report sectioned by month, marketing wants a cumulative, or running, count of invoices to date at the end of each section as well as a total count of each month’s invoices included as section trailers.
To generate these record counts, the following is coded.
The following figure shows the trailers containing the counts of records.
Explanation: The trailer’s first / entry causes the printer to leave one blank line after the data records and before printing the trailer. The second / entry indicates the end of the trailer’s first line. The identical number-colon entries (95:) set the starting positions of the literal strings that follow them: 'MONTH' 'S NUMBER OF INVOICES: ' and 'NUMBER OF INVOICES TO DATE: '.(Note that the apostrophe in MONTH'S is doubled because a single apostrophe would signal the end of a literal string.) Finally, because each data record in this report represents an invoice, the TRAILER3’s COUNT entry generates a count of each month’s invoices and the SUBCOUNT entry generates a cumulative, or running, count of the invoices. The leading zeros in these 8-byte fields are suppressed.