Example: A manufacturing firm has decided to expand its product line. However, because the Item Number field on its inventory records is too small, the records must be reformatted to allow for more columns for the new products. The Item Number is kept in packed-decimal (PD) format, and the firm wants to add 4 bytes to the current 2 byte field. The new bytes are to precede the current two bytes. The following figure gives the input record layout.
To copy the records and insert the 4 bytes of binary zeros, the following is coded.
The effect of OUTREC processing is shown in the figure below.
Explanation: The records are copied, and OUTREC processing adds 4 bytes of binary zeros (4Z) to the beginning of the Item Number field (21,2). To allow for the 4 additional bytes, the original Item Number field and the fields following it are all copied after the 4 inserted bytes of zeros.