We recently ran into a file from an old system that contained dates where the century wasn't stored. We wanted to use one of the dates to sort the file for a report. Some records in the file already have the year 2000 stored in the date in question. One of our programmers developed a solution to this problem.
We added a file into our production library with just two fields, a two-position year and a two-position century. The file has 100 records in it, one for each year within a century. For each year, the century field contains the value of the century we want assigned to the year. In our case, we use the 20th century for years that are greater than or equal to 40 and the 21st century for years that are less than 40. We use this file to perform a join by year on the file to be sorted by an Open Query File (OPNQRYF) statement. Using the century from the new file mapped into an unused field from the old file-and the year, month, and day from the old file-we achieved the desired sequence.
This solution is flexible enough to use whether you use a one- or two-position century, or 19 and 20 for the century, or 20 and 21. It also provides flexibility on the range of years you want to assign to each century, and you can adjust it as time passes.
The turn of the century is closer than you think, and this is one simple way to provide a stopgap solution to some of the problems you'll face.
- Douglas L. Blake
Editor's note: For more ideas on how to solve problems related to the turn of the century, see "Are You Ready to Play the Dating Game?" elsewhere in this issue.
LATEST COMMENTS
MC Press Online