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:
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:
|
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:
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:
|
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:
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:
|
Example 4
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:
|
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.
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:
|