System variables are the names Easytrieve reserves for runtime facts your program did not store in working storage: whether a READ succeeded, whether sequential input is exhausted, which report page is printing, what date the job sees on the clock, and what condition code the step should return. They are not ordinary FILE fields you DEFINE from input columns. They are product symbols documented in Symbols and Reserved Words for your installed release. Beginners copy examples from an old manual or another site and receive compile errors when a symbol is reserved, misspelled, or only valid inside REPORT subactivities. Worse, treating FILE-STATUS like EOF causes programs to stop on expected not-found keys or to keep processing after a serious I/O error. This overview groups documented families—file status and presence, report counters, environment and audit values—and states plainly what varies by release, site options, and product line. For any symbol not covered here, compile a one-line test and read your listing rather than assuming a universal mainframe cookbook name exists.
User variables come from FILE layouts, DEFINE in Library or activities, and W or S working storage you control. System variables and reserved symbols come from the language product. You assign NET-PAY from GROSS and DEDUCT; you do not DEFINE NET-PAY as a keyword. Likewise you DISPLAY FILE-STATUS after STATUS on READ, but you do not DECLARE FILE-STATUS as a new W field unless documentation explicitly allows a homonym—which it generally does not.
Qualification matters for file-related symbols. Broadcom documents qualified forms such as file-name:RECORD-COUNT and delimiter examples with FILEONE:RECORD-COUNT in syntax topics. The qualifier tells the compiler which file context applies when multiple FILE definitions are active. Report symbols such as PAGE-NUMBER apply in REPORT hooks documented for your release, not arbitrarily in every PROC paragraph.
Internet examples and classroom slides age poorly across Classic, Plus, and Report Generator 11.x function mode. New reserved words arrive in migration bulletins; old field names that matched new keywords fail compile until renamed. The reliable workflow is:
Site EZOPTBL entries, macro libraries, and procedure defaults can change runtime behavior without changing source spelling. Two LPARs on the same version number can still differ in date format or user identity returned by environment facilities. Treat environment values as deployment-specific unless you have verified both compile and execute on the target system.
The most operationally important system values for batch file processing are file status after explicit I/O and file-presence conditions for loop control. These are documented across Language Reference FILE topics, READ and GET statements, and file-presence condition pages—not invented names.
When you code STATUS on READ, GET, PUT, WRITE, or related verbs, Easytrieve sets FILE-STATUS to the access-method return code for that operation. Production error PROCs test FILE-STATUS after keyed READ on VSAM masters, after PUT during replace loops, and after GET on sequential files when SEQUENTIAL is declared on FILE. Pattern: perform the I/O verb with STATUS; branch on zero versus nonzero; log unexpected nonzero values to SYSPRINT before STOP or ABEND.
1234567READ MASTER STATUS IF FILE-STATUS NE 0 DISPLAY 'MASTER READ FAILED' FILE-STATUS CHG-KEY PERFORM ERROR-PROC ELSE MOVE MASTER:NAME TO OUT-NAME END-IF
Exact numeric meanings for not-found, duplicate key, and physical errors are documented in Messages and Codes and FILE organization topics for your release. Do not assume COBOL-style STATUS KEY literals without checking the Easytrieve manual for your file type.
EOF is a file-presence condition: IF EOF file-name is true when the named file has no current record because input is exhausted in supported controlled or synchronized modes. IF NOT file-name tests absence of a successful retrieval in keyed contexts—distinct from whole-file EOF. Automatic JOB INPUT uses a different lifecycle: FINISH procedures handle end processing; Broadcom documents that EOF cannot be true for automatic input files in the same way as controlled GET loops.
1234567JOB INPUT PAYROLL DO WHILE NOT EOF PAYROLL GET PAYROLL IF DEPT EQ 100 PRINT DEPT-RPT END-IF END-DO
Confusing EOF with nonzero FILE-STATUS is a common beginner defect. EOF means no more sequential input in the loop model you chose. FILE-STATUS means the last operation succeeded or failed with a return code. A keyed READ can fail with not-found while the file still contains other records.
Broadcom syntax documentation illustrates RECORD-COUNT with bare, qualified, and parenthesized forms to teach delimiter rules. In runtime contexts, record-count-related symbols reflect statistics tied to file or report processing depending on statement and release. Before using RECORD-COUNT in STOP logic or FINISH procedures, read the automatic versus controlled input rules for your file type. Child pages in this chapter drill into page number, record count, and current line where documented for Report Generator 11.6.
| Concept | Typical use | Caution |
|---|---|---|
| FILE-STATUS after STATUS | Branch after READ, GET, PUT failures | Not interchangeable with EOF; numeric codes are file-type-specific |
| IF EOF file-name | Controlled loop termination on sequential input | Semantics differ for automatic JOB INPUT—see file-presence topic |
| IF NOT file-name | Keyed READ miss before using buffer fields | Not-found is not always end-of-file |
| Qualified file-name:symbol | Disambiguate statistics when multiple FILE definitions exist | Qualifier and symbol must match Symbols documentation |
Report writing introduces system fields that make no sense before PRINT or outside REPORT subactivities. Documentation and syntax overviews commonly reference LEVEL and BREAK-LEVEL during control breaks, TALLY for counting within break groups, LINE-COUNT and PAGE-NUMBER for layout, and LINE-related hooks such as BEFORE-LINE and AFTER-LINE as reserved PROC names. These are not generic working storage you create for any JOB paragraph.
PAGE-NUMBER supports page-oriented TITLE and footing logic. LINE-COUNT tracks vertical position within a page for skip and line placement decisions. Values update as the report engine emits lines. Referencing PAGE-NUMBER in unrelated batch extraction jobs without REPORT activity may compile differently or fail depending on context rules—another reason to verify on your listing.
CONTROL reports compare break fields and invoke procedures at hierarchy changes. LEVEL and BREAK-LEVEL relate to which control break fired. TALLY accumulates counts within break processing documented in report tutorials. BREAK-LEVEL became a newly reserved word in 11.6 migration material; legacy user fields with that name require renames before function-mode compile.
123456REPORT DEPT-RPT CONTROL DEPT BEFORE-BREAK DISPLAY 'BREAK DEPT' DEPT ' LEVEL ' LEVEL AFTER-BREAK LINE 'COUNT' TALLY
Exact spellings and which hooks are reserved PROC identifiers versus assignable fields belong in Symbols and Reserved Words. Copy REPORT examples from your installed manual, not from abbreviated cheat sheets alone.
Environment-related symbols answer audit questions: what date is the processor using, what time did processing start, which job name appears on JCL, which user submitted the step. Report Generator reserved-words material documents SYSDATE and SYSTIME as system date and time fields. Easytrieve Plus Application Reference describes overlapping information as system functions that may use different spellings such as $DATE and $TIME. Treat these as parallel families until you confirm which your compile accepts.
SYSUSERID appears in New Reserved Words migration lists for 11.6. If legacy programs defined a field named SYSUSERID, migration renames are required. For audit headers, prefer documented identity retrieval for your product line rather than hard-coding TSO ids in source. Security products may map submitter, proxy, or batch user differently; document what your test LPAR returns on SYSPRINT when you DISPLAY the symbol.
RETURN-CODE or step return-code-related symbols connect Easytrieve logic to JCL COND and scheduler retry policy. Patterns include setting return codes before STOP when validation fails, or propagating business severity levels. Exact mechanism and reserved spelling are release-specific; batch operations often pair DISPLAY on SYSPRINT with a chosen return code convention the run book documents.
1234567FINISH. PROC TITLE 01 'RUN DATE' SYSDATE ' TIME ' SYSTIME IF ERROR-COUNT GT 0 DISPLAY 'VALIDATION ERRORS' ERROR-COUNT STOP END-IF END-PROC
The snippet illustrates report-oriented date and time symbols in TITLE context. If your compile rejects SYSDATE, check whether your site uses function assignment from the system functions index instead, then format for TITLE with EDIT or formatting builtins documented on your release.
This overview focuses on reserved variables and symbols you reference as fields or conditions. Easytrieve Plus also exposes environment information through system functions documented in the Application Reference. A complete solution may assign a working-storage RUN-DATE from a function, then print RUN-DATE on TITLE, rather than referencing SYSDATE directly. Both patterns appear in real shops. The wrong pattern is guessing a function name from a Plus manual while compiling Report Generator source without checking the listing. See the system functions index and child pages for system date, time, job name, user id, and program name detail.
Child tutorials under this chapter cover individual symbols where Broadcom documents them for Report Generator 11.6: system date, system time, job name, user id, program name, page number, record count, and current line. Read those pages after you confirm the symbol appears in your Symbols reference. When documentation is silent, ask your site compiler support team or open a minimal compile case—do not invent a reserved variable and expect portable behavior.
System variables are labels the Easytrieve teacher already put on the classroom wall: what page of the workbook you are on, whether the file box is empty, what today's date is, and whether the last trip to the file cabinet worked. You do not make those labels yourself with DEFINE. You look at the wall when you need the answer. Different schools may use slightly different wall charts, so you check the chart in your actual classroom —the compiler book for your release—instead of memorizing a chart from another school.
1. System variables in Easytrieve are:
2. FILE-STATUS after READ with STATUS typically holds:
3. IF EOF PAYROLL tests:
4. PAGE-NUMBER and RECORD-COUNT are meaningful primarily:
5. The authoritative list of system symbols for your site is:
System variables are predefined symbols the product supplies for runtime and report contexts—file status after I/O, end-of-file presence, page and line counters during reports, processing date and time fields, return codes, and related reserved words. You reference them where documented; you do not DEFINE them as ordinary Library fields.
FILE-STATUS records the result of a specific I/O operation when you use STATUS on verbs such as READ, GET, or PUT. EOF answers whether a named file is exhausted in supported controlled or synchronized input modes. A not-found keyed READ may set a nonzero FILE-STATUS while the file itself is not at EOF.
SYSDATE and SYSTIME are documented reserved system date and time symbols. Using them as user-defined field names conflicts with language rules. Migration guides also reserved additional words such as SYSUSERID in 11.6 function mode—rename legacy fields that collide.
Not always. Plus documentation describes some environment values as system functions with sigils such as $DATE, while Report Generator Symbols topics list reserved fields like SYSDATE. Treat naming as release-specific and confirm on your compiler listing.
Open Broadcom Symbols and Reserved Words for your installed version, review New Reserved Words if migrating to 11.6, and compile a small program that references symbols you plan to use. The listing and cross-reference report show which tokens the compiler accepted.