In Easytrieve documentation, FIELD is both a concept and a parameter: the field-name you choose becomes the handle for every IF, assignment, PRINT, LINE, and DISPLAY for that storage. Unlike COBOL level numbers, Easytrieve uses flat unique names with optional file qualifiers. LAST-NAME overlays NAME; HIRE-MM overlays DATE-OF-HIRE; WS-TAX lives in working storage W with no file position. System fields like SYSDATE sit outside your DEFINE list but appear in titles and macros. Beginners confuse field—the noun—with FIELD as a statement keyword in other languages; here it is the identity of bytes in memory or on disk. This page explains naming rules, qualified references, overlay children as fields, how fields participate in expressions, and discipline for enterprise data dictionaries shared across hundreds of batch programs.
Any symbol defined by FILE line, DEFINE line, or provided by the product as system field. Each field has storage: bytes in a record, working storage block, or static area. Attributes from definition determine how assignments convert values and how reports edit output. Undefined names in JOB logic produce compile errors—compiler enforces define-before-use.
Length one through 128 characters. Start with letter, digit, or # @ $. Not all digits. No delimiters inside name. Case sensitivity follows site and compiler options—treat names as case-sensitive for safety. Hyphens improve readability in column listings: PAY-GROSS versus PAYGROSS. Apostrophes inside names are invalid—training manual warns EMP'L-NO fails; use EMP-NO instead.
| Name | Valid? | Notes |
|---|---|---|
| EMP-NO | Yes | Hyphen allowed |
| GROSS | Yes | Letters only |
| 12345 | No | All numeric |
| #REGION | Yes | National char start |
| EMP'NO | No | Apostrophe delimiter |
When multiple files define EMPNO, qualify with file name: PERSNL:EMPNO versus ARCHIVE:EMPNO. Qualifier disambiguates for compiler and readers. Unqualified EMPNO when both exist is error or ambiguous resolution depending on context. Macros generating standard layouts should document which file owns canonical field definitions.
12345IF PERSNL:DEPT EQ '911' PRINT DETAIL-RPT END-IF WS-NET = PERSNL:GROSS - WS-TAX
Parent field owns absolute position in FILE. Child overlay reuses parent bytes with optional +offset. LAST-NAME NAME 8 A is child of NAME 17 16 A—starts byte one of parent in overlay syntax. Both names are independent fields for IF and LINE—changing LAST-NAME bytes changes corresponding bytes in NAME. Order in source: define parent before children.
12345678NAME 17 16 A LAST-NAME NAME 8 A FIRST-NAME NAME +8 8 A DATE-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
Fields with location W or S are not FILE record columns—they exist only in program memory. WS-TAX W 5 P 2 is field holding tax amount for current calculation. CURR-DATE S 6 N is field holding run date. Referencing them in LINE prints computed values, not file columns unless you copy file data into them first.
SYSDATE, SYSTIME, and other reserved names supply environment values without DEFINE. Appear in TITLE COL SYSDATE and GETDATE macro assignments. Do not DEFINE your own field named SYSDATE—conflicts with system symbol. Consult system variables section for full list per release.
Arithmetic uses numeric fields as operands. IF uses fields in relational and class conditions. Assignment left side must be valid receive field—often working storage or FILE field with UPDATE permission. Right side may combine fields and literals. Type of receive field drives conversion rules from send field or literal.
LINE DEPT LAST-NAME GROSS lists field names whose HEADING and MASK defaults apply. Quantitative fields with decimals participate in SUM when named in SUM statement. Control breaks use CONTROL fieldname—field should be sort-aligned in input. Undefined LINE field is compile error.
VARYING fields have variable active length tracked separately. OCCURS fields repeat fixed layout—index field selects element. Both are still fields with names—subscript syntax documented in programming reference for your release.
File is dataset PERSNL. Record is one row read by JOB INPUT. Field is one column within record—DEPT, GROSS, NAME. Easytrieve blurs record boundary when multiple FILE definitions share buffer—qualifiers keep fields straight. Beginners saying update the file when they mean assign GROSS field should use precise vocabulary in design documents.
A field is a labeled drawer in a filing cabinet. The label is the name you type in code. Some drawers are in the big cabinet that arrives from the computer file; some are on your desk for scratch paper. If two cabinets have drawers with the same label, you must say which cabinet before opening the right drawer.
1. Field names must begin with:
2. File-qualifier syntax looks like:
3. Overlay field HIRE-MM DATE-OF-HIRE 2 N means:
4. A field cannot be all:
5. Before using a field in IF or PRINT you must: