CENTWIN Parameter (Optional) - 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
Content type
Programmer’s Guide
Product name
Syncsort™ MFX
Title
Syncsort™ MFX Programmers Guide
Copyright
2024
First publish date
2010
Last updated
2024-08-27
Published on
2024-08-27T08:14:56.318001

The CENTWIN run-time or installation option acts on 2-digit year data. At run-time, CENTWIN can be specified as either a PARM option or a SORT/MERGE control statement parameter. CENTWIN generates a century window (for example, 1950 through 2049) that determines the century to which a 2-digit year belongs. CENTWIN ensures that year data spanning centuries will be sequenced correctly. Without CENTWIN processing, an ascending collation would sequence the year 01 before the year 98. With CENTWIN processing, the 01 field could be recognized as a twenty-first century date (2001) and would thus be sequenced after 98 (1998).

For more information on specifying the CENTWIN option, see CENTWIN.

CENTWIN processing only applies to data defined as year data formats (Y2B, Y2C, Y2D, Y2P, Y2S, and Y2Z) and the full-date formats (Y2T, Y2U, Y2V, Y2W, Y2X, and Y2Y). These data formats enable MFX to process 2-digit year fields as 4-digit years. A related data format, PD0, can be used to process the month and day portions of packed decimal date fields. To correctly specify date fields for CENTWIN MERGE processing, you should be familiar with the CENTWIN-related data formats.

The following describes each of the year data formats and provides MERGE control statement examples:

The Y2B Format

This format is used to sequence 2-digit, 1-byte binary year data with CENTWIN processing. The binary values are converted to decimal, and the two low order digits are used as year data. Thus, while binary and decimal values range from 00 to 255, year values range from 00 to 99. The relationship between binary, decimal and year values is shown in the following table:

Table 1. Possible Values Representing Year Data with Y2B

Binary Value

Decimal Value

Year Value

X'00' to X'63'

00 to 99

00-99

X'64' to X'C7'

100 to 199

00-99

X'C8' to X'FF'

200 to 255

00-55

The Y2C and Y2Z Formats

These formats represent 2-digit, 2-byte year data in either character (Y2C) or zoned decimal (Y2Z) format. Either Y2C and Y2Z formats can be used with data of the form

X'xyxy'

where y is a hexadecimal year digit 0-9 and x is hexadecimal 0 through F. Y2C and Y2Z ignore the x digits, leaving yy, the 2-digit unsigned year representation.

Suppose you have a character or zoned decimal date field mmddyy that begins at byte 20. You can use either Y2C or Y2Z to process the yy field. As the following example indicates, you could specify three merge keys to correctly process this date:
Figure 1. Sample MERGE Statement

The yy field (24,2) will be processed according to the century window setting. For example, if CENTWIN=1945, the field yy=45 will be sequenced as if it were 1945, and yy=44 would be sequenced as if it were 2044. Thus, for an ascending sequence, 44 would follow 45.

The Y2D Format

This format is used to sequence 2-digit, 1-byte packed decimal year data with CENTWIN processing. Use Y2D to extract the year data yy from packed decimal date fields. For example, consider a 3-byte packed decimal data field defined as

X'yyddds'

This field has the year yy in the first byte and the day ddd in bytes 2 and 3. The packed decimal sign s would be in the last digit (half byte) of the third byte. To merge this date field, which begins at byte 20, with 4-digit year processing, use the following MERGE control statement:
Figure 2. Sample MERGE Statement

The Y2P Format

This format is used to sequence 2-digit, 2-byte packed decimal year data with CENTWIN processing. Use Y2P to extract the year data yy from packed decimal date fields spanning 2 bytes. For example, a packed decimal date of the form yymmdd would be stored as 4 bytes:

yymmdd = X'0yymmddC'

where the trailing C (sometimes F) is a positive sign and the leading 0 pads the field on the left to make an even number of digits.

Notice that the components of the date span bytes:

0y ym md dC

Y2P handles this condition by ignoring the first and last half bytes of the 2-byte field specification. Thus, Y2P processes 0yym as yy, ignoring the leading digit (0) and the trailing digit m that is part of the month.

The following example uses Y2P to collate the year portion of the date field, which begins at byte 20:
Figure 3. Sample MERGE Statement

The field specification 20,2,Y2P treats X'0yym' as X'yy', and CENTWIN processing merges yy as a 4-digit year yyyy.

The PD0 format, described below, can assist Y2P by processing month and day data that overlap year data in the original field.

The Y2S Format

This format is used to sequence 2-digit, 2-byte character or zoned decimal data. The Y2S format is identical to Y2C and Y2Z for valid numeric data, but Y2S treats data that begin with X'00', X'40' or X'FF' as non-year data. Thus, the Y2S format can distinguish records that have non-year data in the first byte of the year field, allowing such records to be collated differently from other records.

Y2S treats non-year data as follows:

  • Data with binary zeros (X'00') or a blank (X'40') in the first byte will not have century window processing applied to it. Instead, such data will be collated in sequence, before valid numeric year data for ascending order or after the year data for descending order.

  • Data with all binary ones (X'FF') in the first byte will also not have century window processing applied to it. Instead, such data will be collated after valid year numeric data for ascending order or before the year data for descending order.

Zones are ignored, as for Y2C and Y2Z, except for data where the first byte begins with X'00', X'40' or X'FF'.

As an example, suppose you want to preserve the input order of header and trailer records at the start or end of the file, and your header/trailer records are identified by binary zeros (X'00'), a blank (X'40') or binary ones (X'FF') in the first byte of the date field. The Y2S format allows CENTWIN to identify the header/trailer records and treat them differently from other records.

The PD0 Format

This format is used to sequence 2-8 byte packed decimal data. PD0 ignores the first digit and trailing sign during processing. PD0 is normally used in conjunction with the Y2P data format. The Y2P format is used to process the 2-digit year portion of a packed decimal date field, while the PD0 format is used to process the month and day portion of the field.

Although PD0 is typically used with Y2P, CENTWIN processing is not applied to PD0.

Consider the packed decimal date field used in the Y2P example above:

yymmdd = X'0yymmddC'

where the trailing C (sometimes F) is a positive sign and the leading 0 pads the field on the left to make an even number of digits.

Notice that the components of the date span bytes:

0y ym md dC

The date can be processed as follows:
  • Y2P processes the year component X'0yym' as X'yy'.

  • PD0 processes the month and day components X'ymmddC' as X'mmdd'.

The following MERGE control statement can be used to collate the entire date with CENTWIN processing:
Figure 4. Sample MERGE Statement

Full-Date Formats

Full-date formats can be used to merge various date fields, processing dates ending or starting with year digits. They also process non-date data that are used with dates. For a full description of full-date formats, see the following section.