Converting Unprintable Data to Readable Form - 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
ContentType
Programmer’s Guide
Product name
Syncsort™ MFX
Title
Syncsort™ MFX Programmers Guide
Topic type
How Do I
Copyright
2024
First publish date
2010
ft:lastEdition
2024-08-27
ft:lastPublication
2024-08-27T08:14:56.318001

Example: For a file of invoice records sorted by company name, the Invoice Amount, Amount Paid, and Balance Due fields are to be converted from packed-decimal to printable format. In addition, any leading zeros will be suppressed and both commas and decimal points will be inserted. (The following figure gives the input record layout.)

Figure 1. Input Record Layout

To sort the records, convert the three fields of packed-decimal data, and insert the commas and decimal points, the following is coded.

Figure 2. JCL and Required Control Statements

The effect of OUTREC processing on the input record is shown in the following figure.

Figure 3. Post-OUTREC Record Layout

Explanation: First the records are sorted alphabetically by company name (1,23,CH). Then, three fields--the Invoice Amount (24,4,PD), the Amount Paid (28,4,PD), and the Balance Due (32,4,PD)--are converted from packed-decimal (PD) into readable format and editing by an MFX editing mask (M2) that suppresses the printing of leading zeros and inserts the appropriate commas and decimal points. The number-colon entries (c:) that precede each of the four fields assign a new starting position or, when printing, column for each of the four fields. For example, the Company Name field, which originally began in byte 1 for a length of 23 bytes, now begins in byte 17; the Invoice Amount field, which began in byte 24, begins in byte 52, and so on. Note that after the data is converted and edited, the lengths of the packed-decimal fields increase from four bytes each to ten bytes and that the fields are each separated by twelve blanks.