Easytrieve SYSDATE — System Date Variable

SYSDATE is one of the first system variables beginners encounter because nearly every production report needs a run date in the header. Broadcom Easytrieve Report Generator defines SYSDATE automatically—you never DECLARE or DEFINE it in the Library section. At the moment Easytrieve execution starts, the product loads SYSDATE with the current system date from the mainframe clock. That value stays read-only for the life of the run unless your installation uses special test overrides. Payroll registers show SYSDATE so operators know which calendar day produced the listing. Audit extracts stamp processing date without hard-coding literals that go stale every midnight. TITLE lines place SYSDATE at column sixty in countless shop standards. Understanding SYSDATE means understanding how Easytrieve separates display dates from numeric date fields, how the Options Table DATE and DATESEP settings shape what you see, and when to prefer SYSDATE-LONG for century-safe archives. This page covers syntax, format options, assignment into working storage, report TITLE patterns, comparison with business as-of dates from files, migration from legacy macro %GETDATE, and mistakes that cause wrong IF tests or truncated headers.

Progress0 of 0 lessons

What SYSDATE Is

System-defined fields are maintained internally by Easytrieve. SYSDATE belongs to the general-purpose family documented alongside SYSTIME and RETURN-CODE. You reference SYSDATE by name in assignment statements, IF conditions where type rules allow, DISPLAY diagnostics, and REPORT TITLE or LINE lists. The field is read-only: assignment to SYSDATE itself is not the supported pattern. Instead, move SYSDATE into a working storage field when you need to edit, strip separators, or compare against file dates stored in numeric form.

SYSDATE characteristics (Broadcom 11.6)
AspectBehavior
When setSystem date at start of Easytrieve execution
WritableRead-only system field
DEFINE requiredNo—reserved system name
Typical formatMM/DD/YY with slash separators (DATE option)
Century variantSYSDATE-LONG for MM/DD/YYYY style

Date Format and Options Table

The DATE option in the Easytrieve Options Table determines how dates appear in the compiler listing and how SYSDATE and SYSDATE-LONG are stored for your installation. DATESEP sets the separator character—often a slash. European shops may configure day-before-month ordering. Never assume your test LPAR matches production without checking both listings. A TITLE line that fits eight characters on one system may truncate on another if DATE option uses a longer pattern. Run a one-line DISPLAY program after any Options Table change affecting DATE or DATESEP.

SYSDATE Versus SYSDATE-LONG

SYSDATE-LONG holds the same execution-start calendar date but includes the century in the external representation. Year-end archival jobs and compliance extracts increasingly require four-digit years to avoid ambiguity when rerunning historical comparisons. TITLE formatting options LONGDATE and SHORTDATE on some report statements map to these system fields—LONGDATE prints SYSDATE-LONG while SHORTDATE prints SYSDATE. Choose the variant that matches your retention policy and downstream file consumers.

Using SYSDATE in Reports

Report titles are the most visible SYSDATE usage. Place the system field at a fixed column so multi-page listings align in SDSF. Combine literal text with SYSDATE rather than embedding dates in source that require recompile after calendar roll. NODATE on formatting options suppresses automatic date insertion when you want full manual control—useful when TITLE already positions SYSDATE explicitly.

text
1
2
3
4
5
6
REPORT PAYROLL-RPT TITLE 01 'PAYROLL REGISTER' TITLE 02 'RUN DATE:' COL 55 SYSDATE JOB INPUT PERSNL LINE EMP-NAME GROSS NET-PAY

TITLE 02 prints the literal RUN DATE label starting at column fifty-five followed by SYSDATE at the position the report writer calculates from COL. Adjust column to match your shop standard—sixty is common on one-thirty-two-column listings.

Assignment Into Working Storage

Copy SYSDATE once at job initialization when the same run date must appear on every page and output record. Define a working field wide enough for the formatted string—often eight to ten alphabetic bytes for slash forms, more for SYSDATE-LONG. Numeric date math on hire dates or period-end fields requires conversion: SYSDATE display form with slashes does not compare directly to a six-digit numeric N field storing YYMMDD. Use date macros such as %DATEVAL or documented date functions after copying and normalizing separators.

text
1
2
3
4
5
6
7
8
9
10
11
12
13
DEFINE RUN-DATE W 10 A DEFINE RUN-DATE-N W 6 N INIT-JOB. PROC RUN-DATE = SYSDATE * Convert for numeric compares—verify macro on your release %DATEVAL RUN-DATE-N RUN-DATE END-PROC JOB INPUT CONTROL-FILE START INIT-JOB IF PERIOD-END GT RUN-DATE-N DISPLAY 'WARNING: PERIOD END AFTER RUN DATE' END-IF

Run Date Versus Business As-Of Date

SYSDATE answers when did this job execute operationally. Payroll period-end date on a control record answers which pay cycle the numbers belong to. Monthly financial close may run on the fifth calendar day while the business as-of remains last day of prior month. Display both on audit headers: period end from file, run date from SYSDATE. Schedulers sometimes pass as-of dates through JCL PARM or SYSIN—prefer those parameters for business logic when they override calendar run date. SYSDATE remains valuable for operational traceability even when business date comes from elsewhere.

SYSDATE and Midnight Boundaries

SYSDATE is fixed at execution start. Long-running batch that crosses midnight does not refresh SYSDATE automatically. A job starting at eleven fifty-five PM and finishing at twelve ten AM still shows the start date in SYSDATE. Capture RUN-DATE in initialization if downstream steps need a single consistent stamp for the entire job. For row-level timestamps requiring current clock during processing, see SYSTIME patterns or explicit time functions—not SYSDATE alone.

SYSDATE in DISPLAY and Diagnostics

Development programs DISPLAY SYSDATE alongside file counts to correlate test output with calendar day. Production FINISH procedures sometimes DISPLAY run date when RETURN-CODE is non-zero so operations logs show context without opening JCL. Keep DISPLAY volume reasonable on large production runs—one banner at START or FINISH suffices for date context.

Common SYSDATE Mistakes

  • Defining a user field named SYSDATE—reserved word collision.
  • Comparing slash-form SYSDATE directly to numeric file dates without conversion.
  • Assuming SYSDATE updates at midnight during a long job.
  • Using two-digit year SYSDATE for century-critical archives when SYSDATE-LONG is required.
  • Confusing run date with pay-period or fiscal as-of from control files.
  • Title column too narrow—truncated date on wide DATE option formats.

Explain It Like I'm Five

SYSDATE is a sticker the computer puts on your report showing today's date when the program starts. You do not make the sticker yourself—it is already there. You can copy the sticker onto your own paper if you need to cut off the slashes or compare the date to numbers in a file. The sticker does not change if the clock strikes midnight while your program is still running; it keeps the date from when you started.

Exercises

  1. Write a REPORT with TITLE showing SYSDATE at column 60.
  2. Copy SYSDATE to RUN-DATE in an INIT procedure and reference RUN-DATE in TITLE.
  3. Explain when to use SYSDATE-LONG instead of SYSDATE on a year-2000-safe archive.
  4. List three differences between SYSDATE and a PERIOD-END field on an input control record.
  5. DISPLAY SYSDATE and SYSDATE-LONG in a test job; note format from your Options Table.

Quiz

Test Your Knowledge

1. SYSDATE in Easytrieve contains:

  • The system date at the start of Easytrieve execution
  • The date from each input file record
  • The compile date of the source
  • A date you must DEFINE in Library

2. SYSDATE is normally formatted with:

  • Slashes between month, day, and year (MM/DD/YY)
  • Hyphens only (YYYY-MM-DD)
  • Packed decimal with no separators
  • Julian yyyyddd only

3. SYSDATE-LONG differs from SYSDATE because it:

  • Includes the century in the date
  • Updates every input record
  • Stores time of day
  • Requires a DEFINE statement

4. You should assign SYSDATE to a working field once when:

  • The run date must stay constant for the entire job even if execution crosses midnight
  • Every detail line needs a new calendar lookup
  • SYSDATE is undefined without DEFINE
  • TITLE lines cannot reference SYSDATE directly

5. Attempting to DEFINE a field named SYSDATE:

  • Conflicts with the reserved system field name
  • Is required before first use
  • Creates a second independent date
  • Is the only way to use dates in reports
Published
Read time16 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve Report Generator 11.6 General Purpose Fields SYSDATESources: Broadcom Easytrieve 11.6 System-Defined Fields, International Options DATE DATESEPApplies to: Easytrieve SYSDATE and SYSDATE-LONG system variables