A date format is an agreement about what each digit position means—not a separate Easytrieve type code. Six digits might be March 15, 1985 in MMDDYY or May 31, 1985 in YYMMDD if you misread the copybook. Eight digits might be 19850315 in CCYYMMDD or a corrupted sort key if someone swapped month and day. Julian YYDDD packs year and day-of-year into five digits common in tape management and legacy control files. Easytrieve handles formats through field length, overlay components, edit masks like Z9/99/99, and optional routines DATECONV, DATEVAL, and DATECALC with format literal parameters. This page compares format families, documents THRESHOLD century rules, and gives beginners a checklist for matching file layout to processing logic without silent century bugs.
| Format name | Typical digits | Example meaning | Easytrieve approach |
|---|---|---|---|
| MMDDYY | 6 N | 031585 = Mar 15, 1985 | Overlays MM DD YY on N 6 |
| YYMMDD | 6 N | 850315 = Mar 15, 1985 | Overlays YY MM DD |
| MMDDCCYY | 8 N | 03151985 | Four-byte year overlay CCYY |
| CCYYMMDD | 8 N | 19850315 ISO-style | Sort-friendly century first |
| YYDDD Julian | 5 N | 85074 = day 74 of 1985 | DATECONV with YYDDD literal |
| Display with slashes | 8–10 A or masked N | 03/15/85 | SYSDATE or MASK Z9/99/99 |
Classic Easytrieve training files use six-byte N DATE-OF-HIRE with month day year overlays. Sorting MMDDYY strings lexically as numbers does not sort chronologically within a year—031585 before 122584 correctly by month but cross-year sorts need CCYY or internal day count. Reports printing hire dates often apply MASK Z9/99/99 so 031585 displays as 03/15/85 with slashes inserted at print time only.
12345DATE-OF-HIRE 136 6 N HIRE-MM DATE-OF-HIRE 2 N HIRE-DD DATE-OF-HIRE +2 2 N HIRE-YY DATE-OF-HIRE +4 2 N MASK Z9/99/99
Eight-digit formats eliminate two-digit year ambiguity when century is stored explicitly. CCYYMMDD supports straight numeric sort as chronological sequence—19850315 before 19991231. MMDDCCYY keeps US month-first readability with four-digit year trailing. Overlay design changes: CCYY may occupy bytes five through eight or one through four depending on format. Transcription errors from six-digit legacy files often pad century with 19 or 20 constants in assignment logic—document assumptions in program header comments.
Julian format stores two-digit year plus three-digit day-of-year 001 through 366. Tape management and operations files use Julian for compact sorting by day within era. Easytrieve DATECONV documentation states the only valid Julian format literal is YYDDD—not MM DD combinations. Converting Julian input to Gregorian output requires DATECONV with correct format pair; manual division is error-prone near leap years.
Routines accept format parameters built from letter pairs: MM month, DD day, YY year, CC century. Pairs may appear in any order for non-Julian dates—MMDDCCYY, YYMMDD, DDMMYY per documentation examples. CC requires YY in the same format specification. DATEVAL validates field content against format before conversion. Invalid dates like month 13 set DATEVAL-FLAG to NO instead of silently corrupting downstream fields.
1234%DATEVAL INPUT-DATE MMDDCCYY IF DATEVAL-FLAG EQ 'YES' %DATECONV INPUT-DATE MMDDCCYY OUTPUT-DATE CCYYMMDD END-IF
When source dates use two-digit years without CC, THRESHOLD on DATECONV and DATECALC assigns centuries. Example from documentation: processing 1949–1952 with THRESHOLD 50 maps 49 and 50 to 2049 and 2050 while 51 and 52 remain 1951 and 1952. Wrong THRESHOLD shifts entire cohort eligibility dates in pension reports. Prefer eight-digit storage for new interfaces; reserve THRESHOLD for legacy feeds you cannot change immediately.
Getting Started lists standard masks including Z9/99/99 for dates and 99/99/99 for social security style grouping. Each nine in mask maps to one digit from numeric field. Z suppresses leading zeros in some positions per mask rules. Commas in masks print only when value magnitude warrants—date masks focus on slash placement. MASK on DEFINE applies to LINE TITLE DISPLAY without altering stored N digits.
SYSDATE often appears as eight characters including slash separators in macro examples— 11/24/83 style—while user numeric fields strip slashes to 112483 six-digit form. Know which format each variable carries before comparing to FILE dates. Conversion macros encapsulate strip logic so application code receives consistent six-digit N.
Date format is the order you say birthday parts: month-day-year versus year-month-day. If everyone agrees March 15, 1985 is 031585, the computer reads it correctly. If one file uses 850315 and another 031585 without labels, the computer thinks different days. Julian is a special code counting days in the year like day seventy-four instead of naming March. Always check the label on the box before opening the numbers inside.
1. Format literal MMDDYY means:
2. Only valid Julian format in DATECONV documentation is:
3. THRESHOLD on DATECONV controls:
4. Edit mask Z9/99/99 is used for:
5. Before DATECONV you should use DATEVAL when: