Sample OUTREC Control Statements with CENTWIN Processing - 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

For century window processing, data conversion is determined by the century window defined by the CENTWIN parameter.

The following provides examples of data conversion with CENTWIN:

Example 1

A 2-digit year field in character format at position 20 in the input record could be expanded with the following specification:

Figure 1. Example 1, OUTREC Control Statement with Year Data

Note that the expansion of the year data from 2 to 4 digits increases the output record length by 2 bytes compared to the input record length.

The CENTWIN setting determines the century of the 2-digit year field. If CENTWIN=1980, then a year field in the input record would be converted as follows:

SORTIN Input

OUTREC Output

13

2013

79

2079

80

1980

92

1992

Example 2

Consider the following packed decimal date field at position 20 in the input record:

yymmdd = X'0yymmddC'

Suppose you want to output a displayable 4-digit year in character format in the form

mm/dd/yyyy

To accomplish this, specify the following OUTREC control statement:

Figure 2. Example 2, OUTREC Control Statement with Year Data

The 4-digit year output from the input year field (20,2,Y2P) depends on the CENTWIN setting. The following sample of input and output data shows the case for CENTWIN=1980:

SORTIN Input Date Field

OUTREC Output Date Field

X'0800329C'

03/29/1980

X'0790603C'

06/03/2079

Example 3

To expand a 3-byte packed decimal date field of the form X'yyddds', at position 20 in the input record, to a 4-byte packed field of the form X'yyyyddds' that contains a prefixed century value, specify an OUTREC control statement such as the following:

Figure 3. Example 3, OUTREC Control Statement with Year Data

Note that in the above example the output record length will be 1 byte larger than the input record length. The following sample of input and output data shows the effect for CENTWIN=1980:

SORTIN Input Date Field

OUTREC Output Date Field

X'79'

X'2079'

X'80'

X'1980'

Example 4

To expand a 4-byte packed decimal date field of the form X'0yymmdds', at position 20 in the input record, to a 5-byte field of the form X'0yyyymmdds' that contains a prefixed century value, specify an OUTREC control statement such as the following:
Figure 4. Example 4, OUTREC Control Statement with Year Data

As with Y2ID conversion, the output record length will be 1 byte larger than the input length. The following sample of input and output data shows the effect for CENTWIN=1980:

SORTIN Input Date Field

OUTREC Output Date Field

X'0790'

X'020790'

X'0801'

X'019801'

Example 5

Consider a 2-byte character or zoned decimal field that may contain either valid numeric year data or characters that identify the record as a header or trailer. Header records in the example are identified by zeros (X'00') or a blank (X'40') in the first byte of the year field, while trailer records are identified by binary ones (X'FF') in the first byte of the field. The Y2S format will treat the valid year data normally, in the same way as the Y2C or Y2Z formats would treat the data, but the year fields of header and trailer records will be converted to a 4-digit form padded on the left with data identical to the data in the first byte of the input field.

Typically this type of conversion is needed when a Y2S SORT or MERGE field is used to collate the records so that header/trailer records in the output remain at the start or end of the file. An OUTREC control statement such as the following could be used.

Figure 5. Example 5, OUTREC Control Statement with Year Data

As with Y2C or Y2Z, the output record length will be 2 bytes larger than the input record length.

For CENTWIN=1990, the sorted Y2S field would be converted as follows:

SORTIN Input Date Field

OUTREC Output Date Field

X'4001'

X'00000000' (from 4th input record)

X'F9F8'

X'40404001' (from 1st input record)

X'F0F3'

X'F1F9F9F8' (from 2nd input record)

X'0000'

X'F2F0F0F3' (from 3rd input record)

X'FFFF'

X'FFFFFFFF' (from 5th input record)