TechTalk: Use this stopgap to sort a report where some records store century and some don't.

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: