Combining Records and Summing Numeric Data Fields - 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 an inventory list, a company requires a single record for each product, indicating its item number, warehouse code, and the total quantity in stock. (The figure Input Record Layout gives the sample record layout.)

Figure 1. Input Record Layout

To combine those inventory records with identical item numbers and warehouse codes and to produce the required list, the following is coded.

Figure 2. JCL and Required Control Statements

Explanation: The list is generated by sorting on the Warehouse Code field (6,1,CH) and the Item Number field (1,5,ZD). Records that have identical information in both these fields are combined into a single record that contains the sum or total of those records’ Quantity fields (7,12,PD). That is, the single record will show how many items with the same number are in each warehouse.