Easytrieve advertises an English-like, free-form language—which is true within the rules the compiler enforces. Before you master FILE or JOB statements, you need the ground rules: how long a source line is, where statements may start, what ends a statement, which characters separate words, and how comments and continuations work. Syntax errors often look mysterious until you know whether the compiler stopped at a missing period, an invalid delimiter inside a field name, or a reserved word used as an identifier. This overview is the reference frame for every specialized syntax topic that follows.
Each Easytrieve source record is 80 characters, matching classic mainframe punch card and ISPF edit conventions. The default statement area occupies columns 1 through 72. You may place code anywhere within that area; indentation is optional but strongly recommended for nested IF and DO blocks. Columns 73-80 sometimes hold sequence numbers for shop standards or sort utilities—they are outside the default statement area unless your site configures otherwise.
Statements consist of words: keywords with special meaning to Easytrieve, field names and labels you define, literals representing constant values, and symbols in expressions. Words begin with a non-blank character and end at a delimiter or the statement area boundary. The compiler tokenizes each line using delimiter rules before checking grammar for FILE, JOB, REPORT, and other constructs.
| Delimiter | Role |
|---|---|
| Space | Basic separator between words within a statement |
| Period (.) | Terminates a statement; separates multiple statements on one line |
| Comma (,) | Optional readability separator in parameter lists |
| Single quote | Encloses alphanumeric literals |
| Parentheses | Group parameters and expression subparts |
| Colon (:) | Qualifies file, record, or WORK for field names |
At least one space must follow most delimiters except left parenthesis and colon in documented cases. RECORD-COUNT, FILEONE:RECORD-COUNT, and (RECORD-COUNT) illustrate the same identifier with different delimiter contexts. Misplaced periods inside literals or names truncate statements early and produce confusing error cascades.
Keywords are words with defined meaning—FILE, JOB, IF, REPORT, PERFORM, and hundreds more in the language reference. Some keywords are reserved and cannot be used as field names. Others are non-reserved and may appear as identifiers when context allows. Using IF as a field name fails; using a non-reserved word might succeed but harm readability. Reserved word lists appear in Broadcom Symbols and Reserved Words documentation for your release.
Field names may be up to 128 characters from letters, digits, and special characters except delimiters. The first character must be alphabetic, numeric, or national (#, @, $), but the name cannot be all numeric. Field names must be unique within a file and across working storage unless qualified with FILE: or WORK:. Labels for PROGRAM, JOB, PROC, REPORT, and SCREEN follow similar length and character rules but cannot consist entirely of digits.
1234FILEA:FLD1 WORK : TOTAL-COUNT PAYJOB CHECK-REGION
Alphanumeric literals use single quotes up to 254 characters. Embedded quotes double the quote character: O'KELLY becomes 'O''KELLY'. Numeric literals allow up to 18 digits with optional sign prefix and decimal point. Hexadecimal literals use X'...' notation with hex digits 0-9 and A-F, packing pairs into bytes. Literals appear in IF comparisons, MOVE sources, TITLE text, and MASK parameters.
A line whose first non-blank character is asterisk is a full-line comment. Inline comments follow a period, spaces, asterisk, and comment text on the same line as a statement. Blank lines are treated as comments. You cannot place comments inside a continued statement spanning lines—comment placement rules interact with continuation syntax covered in the continuation lines topic.
1COST = FIXED + VARIABLE. PRICE = COST + PROFIT
A period followed by space ends the first statement and starts the next within the same statement area. Dense one-liners save vertical space but hurt readability in production source. Most shops limit multi-statement lines to trivial assignments.
Expressions use +, -, *, and / with spaces around operators as documented. Multiplication and division bind tighter than addition and subtraction following conventional rules. Parentheses group subexpressions. Type mismatches between alphanumeric and numeric fields in expressions cause compile or runtime issues depending on context.
Syntax rules apply uniformly, but statement availability depends on section. FILE belongs in Library. JOB INPUT belongs in Activity. REPORT TITLE belongs in REPORT subactivities. Valid tokens in the wrong section fail even when spelled correctly. Section-aware syntax is part of writing compilable programs, not a separate language dialect.
Syntax is the grammar of a language. Easytrieve lines are like sentences on a small piece of paper eighty boxes wide. You write in the first seventy-two boxes. Periods end sentences. Spaces separate words. Quotes wrap exact text you mean literally. Stars make the whole line a note to humans that the computer ignores. If you break grammar, the compiler teacher marks the paper before the program can run.
1. Easytrieve source records are typically:
2. The default Easytrieve statement area is:
3. A full-line comment starts with:
4. Field names can be up to:
5. Multiple statements on one line are separated by: