Easytrieve Syntax Overview

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.

Progress0 of 0 lessons

Source Records and Statement Area

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.

Words That Build Statements

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.

Delimiters

Easytrieve delimiters and their roles
DelimiterRole
SpaceBasic separator between words within a statement
Period (.)Terminates a statement; separates multiple statements on one line
Comma (,)Optional readability separator in parameter lists
Single quoteEncloses alphanumeric literals
ParenthesesGroup 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 and Reserved Words

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.

Identifiers: Field Names and Labels

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.

text
1
2
3
4
FILEA:FLD1 WORK : TOTAL-COUNT PAYJOB CHECK-REGION

Literals

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.

Comments

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.

Multiple Statements Per Line

text
1
COST = 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.

Arithmetic Operators

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 and Program Sections

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.

Common Syntax Errors

  • Missing period before END-PROC or between statements on one line.
  • Reserved keyword used as a field name.
  • Unqualified duplicate field names across files.
  • Invalid characters inside identifiers (commas, quotes, parentheses).
  • Statement extending past column 72 without continuation character.

Explain It Like I'm Five

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.

Exercises

  1. Write a valid alphanumeric literal containing an apostrophe in a name.
  2. List five delimiters and give an example of each in context.
  3. Explain the difference between a keyword and a field name.
  4. Code two simple assignments on one line using period-space separation.
  5. Describe why qualification FILE:FIELD is needed when names duplicate.

Quiz

Test Your Knowledge

1. Easytrieve source records are typically:

  • 80 characters long
  • 132 characters required
  • Unlimited length
  • 40 characters only

2. The default Easytrieve statement area is:

  • Columns 1 through 72
  • Columns 73 through 80 only
  • Columns 8 through 11 only
  • Columns 1 through 60

3. A full-line comment starts with:

  • Asterisk (*) as first non-blank character
  • Double slash
  • HASH symbol
  • Percent sign

4. Field names can be up to:

  • 128 characters
  • 8 characters only
  • 30 characters
  • 256 characters

5. Multiple statements on one line are separated by:

  • Period followed by space
  • Semicolon only
  • Comma alone
  • END-IF
Published
Read time12 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 syntax rules from Getting Started and Language ReferenceSources: Broadcom Easytrieve Report Generator 11.6 TechDocs, Library Section syntax rules, Language ReferenceApplies to: Easytrieve source coding syntax fundamentals