Using internal bridging
For internal bridging, you need to structure your program appropriately.
About this task
Do the following steps:
Procedure
- Read the input files with two-digit-year dates.
- Declare these two-digit dates as windowed date fields and move them to expanded date fields, so that the compiler automatically expands them to four-digit-year dates.
- In the main body of the program, use the four-digit-year dates for all date processing.
- Window the dates back to two-digit years.
- Write the two-digit-year dates to the output files.
Results
This process provides a convenient migration path to a full expanded-date solution, and can have performance advantages over using windowed dates.
When you use this technique, your changes
to the program logic are minimal. You simply add statements to expand
and contract the dates, and change the statements that refer to dates
to use the four-digit-year date fields in WORKING-STORAGE
instead
of the two-digit-year fields in the records.
Because you are
converting the dates back to two-digit years for output, you should
allow for the possibility that the year is outside the century window.
For example, if a date field contains the year 2020, but the century
window is 1920-2019, then the date is outside the window. Simply moving
the year to a two-digit-year field will be incorrect. To protect against
this problem, you can use a COMPUTE
statement to
store the date, with the ON SIZE ERROR
phrase to
detect whether the date is outside the century window.