Century windowing in DFSORT is the rule that turns a 2-digit year (yy) into a full 4-digit year (ccyy) by assuming the year falls inside a fixed 100-year range—the "window." For example, a common default is: 40–99 → 1940–1999 and 00–39 → 2000–2039. So when you use Y2T or Y2W (2-digit year formats), the value 99 is interpreted as 1999 and 25 as 2025. That works well when all your dates lie inside that window. If your data has a 2-digit year outside the window (e.g. 25 meaning 1925), the converted date can get the wrong century. This page explains how century windowing works, when it applies, how to avoid errors, and (where supported) how to change the window.
Century windowing applies whenever DFSORT reads a date that uses a 2-digit year. That happens when you specify Y2T or Y2W as the source format. Y2T means year first with 2 digits (e.g. yymmdd or yyddd); Y2W means year last with 2 digits (e.g. mmddyy or dddyy). As soon as the product has to interpret yy, it uses the active century window to decide whether yy means 19xx or 20xx. Formats Y4T and Y4W use a 4-digit year (ccyy) in the input, so no window is needed—the century is already in the data.
A typical default is:
| 2-digit year (yy) | Interpreted as (ccyy) |
|---|---|
| 00 – 39 | 2000 – 2039 |
| 40 – 99 | 1940 – 1999 |
So 00 → 2000, 39 → 2039, 40 → 1940, 99 → 1999. The idea is to cover both recent past (1940s–1990s) and near future (2000–2039) with a single rule. Your installation may use a different default; check your DFSORT documentation or SYSOUT messages.
If your data has a 2-digit year that is intended to mean a year outside the window, the conversion will be wrong. Example: birth dates in a file with yy=25 meaning 1925. With 00–39 → 2000–2039, yy=25 is interpreted as 2025. The converted date then has the wrong century. Similarly, if you had yy=40 meaning 2040 (e.g. a future expiry), with 40–99 → 1940–1999 you would get 1940 instead of 2040. So whenever you use Y2T or Y2W, be sure your data either falls within the product's window or that you set a different window if the product allows it.
Around the year 2000, many systems had to decide how to treat yy=00, 01, 02, etc. Without a defined rule, some would assume 1900, 1901, 1902 and others 2000, 2001, 2002. Century windowing made the choice explicit: with 00–39 → 2000–2039, "00" in a date field is consistently 2000. That was part of the Y2K fix. When reading legacy documentation or maintaining old jobs, you may still see references to "century window" or "pivot year" from that era.
The window is used whenever DFSORT interprets a 2-digit year: during date conversion (TOGREG, TOJUL) in INREC or OUTREC, and in any other processing that parses a date with Y2T or Y2W. It is not used for 4-digit year formats (Y4T, Y4W) or for the current date (DATE=, TIMENS=) inserted in headers, which comes from the system and is already full year.
Input has a 6-byte date at position 40 in yymmdd form. Value 251015 (October 15, 2025). With default window 00–39 → 2000–2039, yy=25 → 2025. So:
1INREC BUILD=(1:40,6,Y2T,TOGREG=Y4T,7:1,39,46:41,30)
The 6-byte field at 40 is read as Y2T (yymmdd), converted to Gregorian Y4T (ccyymmdd), producing 20251015 at output positions 1–8. If the same bytes were 991015 (October 15, 1999), yy=99 → 1999 and the result would be 19991015. If your data had 991015 meaning 2099 (e.g. far future), you would get the wrong century (1999) unless you change the window.
Imagine someone says "I was born in '25." You have to guess: 1925 or 2025? The computer has the same problem when it sees a year written with only two digits. Century windowing is a rule we give the computer: "If the two digits are 00 to 39, assume 2000–2039; if 40 to 99, assume 1940–1999." So "25" becomes 2025 and "99" becomes 1999. That works as long as our dates really are in that range. If we had an old date like 1925, we'd have to tell the computer a different rule so it doesn't think we mean 2025.
1. What is century windowing in DFSORT?
2. Your data has a 2-digit year 38 (meaning 2038). With a default window 00-39 → 2000-2039, what does DFSORT produce?
3. How can you avoid wrong-century errors when your data has 2-digit years?
4. Which DFSORT format codes use century windowing?
5. Why did century windowing become important around the year 2000?