What is Easytrieve?

Easytrieve is a report generator and data management language used on IBM mainframes and, through Easytrieve Plus, on UNIX, Linux, and Windows. It lets you read files, filter and calculate on records, and print formatted reports using concise, English-like statements instead of the verbose structure required by COBOL or PL/I.

Foundation Tutorial
Progress0 of 0 lessons

Definition of Easytrieve

Formally, Easytrieve is a fourth-generation language (4GL) oriented toward report generation and file-oriented data processing. Where COBOL gives you fine-grained control over every paragraph and division, Easytrieve gives you high-level statements such as FILE, REPORT, SORT, and IF that describe what you want rather than every mechanical step of how to do it.

A typical Easytrieve program defines its files and fields in a Library section, specifies processing in an Activity section, and describes printed output in a Report section. When you compile the source, the Easytrieve compiler generates object code. After linking, you run the load module from JCL in batch or from an online environment that supports Easytrieve execution.

The product name today is CA Easytrieve Report Generator, published by Broadcom. Version 11.6 is the current documentation release and includes enhancements for SQL file access, environment-independent FILE statements, boundary checking, and integration with modern development tooling.

What Easytrieve Is Used For

Organizations reach for Easytrieve when the job is primarily about data in files and information on paper or tape—not about updating a complex online transaction system. Common uses include:

  • Operational reports: daily balance reports, exception lists, audit trails, and summary totals by department or region.
  • File extracts: creating flat files for downstream systems, data warehouses, or partner feeds with selected fields and filters applied.
  • Reconciliation jobs: comparing two files, flagging mismatches, and producing control totals for finance teams.
  • Ad hoc analysis: quick programs written by analysts who need answers from production files without waiting for a full COBOL development cycle.
  • Online inquiry screens: through the Screen section and Easytrieve online facilities, displaying and updating data in terminal sessions.

Easytrieve is not a replacement for a relational database engine. It can read SQL tables through SQL FILE statements in Easytrieve Plus, but its strength remains record-oriented file processing and printed report layout.

How Easytrieve Fits in the Mainframe Stack

On z/OS, an Easytrieve batch job looks like any other batch step. JCL provides DD statements for input files, output files, SYSPRINT for compiler or runtime messages, and sometimes SYSLMOD or STEPLIB for the Easytrieve runtime libraries. Your program source lives in a partitioned dataset member or sequential file. You compile with the Easytrieve compiler, link-edit the object, and execute with a standard EXEC PGM= step pointing at your load module.

Easytrieve sits above access methods (QSAM, BSAM, VSAM, and SQL interfaces) and below the business user who reads the report. The language handles record buffering, page headings, control breaks, and totals so you do not code them line by line as you would in COBOL REPORT SECTION syntax.

The Four Main Sections of an Easytrieve Program

Understanding Easytrieve starts with its program structure. Most programs use some or all of these sections:

Easytrieve program sections
SectionPurposeTypical contents
LIBRARYDeclare files, fields, working storage, proceduresFILE statements, field definitions, W fields, PROC names
ACTIVITYProcessing logic—read, compute, branchJOB, SORT, IF/ELSE, PERFORM, READ loops
REPORTFormatted printed outputREPORT name, LINE, CONTROL, SUM, TITLE
SCREENOnline terminal panelsSCREEN definitions, display and accept fields

A minimal batch report might use only LIBRARY and REPORT. A file-to-file extract adds ACTIVITY logic. Online programs add SCREEN. The compiler processes sections in a defined order and checks that fields referenced in Activity or Report were declared in Library.

Easytrieve vs Other Mainframe Tools

Beginners often ask how Easytrieve compares to COBOL, DFSORT, REXX, SAS, and SQL. Each tool has a sweet spot:

When to choose Easytrieve
ToolBest forEasytrieve advantage
COBOLComplex business applications, CICS, large modular systemsFaster report development; less code for file summaries
DFSORTHigh-volume sort, merge, copy, join without a compiled programControl breaks, headings, and calculated fields in one program
REXXGlue scripts, TSO automation, quick parsingStructured report layout and built-in total logic
SASStatistical analysis and advanced analyticsNative z/OS batch integration; lighter for simple extracts
SQL / Db2Relational queries across normalized tablesFlat-file and legacy sequential workflows; Easytrieve Plus can also read SQL files

A Minimal Easytrieve Example

The following simplified program reads a sequential employee file and prints name and salary for records where the department code equals 100. Line numbers are shown for teaching only; your shop may use different column rules.

text
1
2
3
4
5
6
7
8
9
10
FILE EMPFILE EMP-NAME 1 20 A EMP-DEPT 21 3 N EMP-SALARY 24 7 P 2 REPORT OUTPUT LINE EMP-NAME EMP-SALARY IF EMP-DEPT = 100 PRINT END-IF

The FILE statement names EMPFILE and defines fields by start position, length, and type (A for alphanumeric, N for numeric, P for packed decimal with decimals). The REPORT section names the output report, defines a detail line layout, and uses IF to select records. This is far shorter than equivalent COBOL for the same task.

Batch and Online Execution

Batch

Batch is the most common mode. A JCL job compiles or executes the program. Input files arrive on DD statements matching FILE names in the Library section. Output goes to SYSOUT, a sequential dataset, or a spool class. Batch jobs run on a schedule—nightly, month-end, or on demand—and produce large volumes of paper or flat files.

Online

Easytrieve also supports online execution through screen-driven programs. The SCREEN section defines panels; the runtime displays fields and accepts user input. Online Easytrieve is less common today than batch reporting but remains in production at sites that built inquiry systems before widespread CICS or web front ends.

Key Terms for Beginners

  • FILE — Declares an input or output file and its record layout in the Library section.
  • Field — A named portion of a record, defined by position, length, and data type.
  • W field — A working-storage field not tied to a file; used for calculations and flags.
  • CONTROL break — A report feature that subtotals when a control field value changes (for example, subtotal by department).
  • Load module — The executable program produced after compile and link-edit.
  • SYSPRINT — DD name for compiler listing and runtime diagnostic messages.

Tutorial: Reading Your First Easytrieve Listing

After compilation, open the compiler listing on SYSPRINT. Look for these sections:

  1. Source listing — Your code with line numbers and any error markers.
  2. File and field cross-reference — Which fields belong to which files.
  3. Statistics — Statement counts and storage estimates.
  4. Diagnostic messages — Errors (severity E) stop compilation; warnings (W) may allow proceed.

If compilation fails, the message usually names the line and the undefined field or invalid statement. Fix the Library declaration first—most beginner errors are fields used before they are defined.

Explain It Like I'm Five

Imagine a stack of index cards where each card holds one person's name, team, and allowance money. Easytrieve is a helper that reads every card, picks only the cards for Team Red, copies the name and allowance onto clean sheets of paper in neat rows, and adds up the allowance at the bottom. You tell the helper where on each card to find the name and numbers, which team to keep, and how the paper should look. The helper does the boring copying and math so you do not have to write a long instruction book.

Exercises

  1. In your own words, explain what a report generator does and why mainframe shops use one.
  2. Name the four main sections of an Easytrieve program and give one sentence describing each.
  3. In the sample program above, what would happen if you removed the IF EMP-DEPT = 100 condition?
  4. List two job types where Easytrieve is a good fit and two where COBOL or SQL would be better.
  5. Look up CA Easytrieve Report Generator in Broadcom TechDocs. What is the current release number documented there?

Quiz

Test Your Knowledge

1. What is the primary purpose of Easytrieve?

  • Database administration
  • Report generation and file processing
  • Network routing
  • Operating system installation

2. Which company currently owns Easytrieve?

  • IBM
  • Microsoft
  • Broadcom
  • Oracle

3. Which section of an Easytrieve program defines input and output files?

  • Activity section
  • Library section
  • Report section
  • Screen section

4. Easytrieve programs are typically compiled into what before execution?

  • Java bytecode
  • Load modules (object code)
  • SQL stored procedures
  • HTML templates

5. Which environment is Easytrieve most commonly associated with?

  • Mobile apps
  • z/OS mainframe batch
  • Web browsers only
  • Embedded IoT devices
Published
Read time12 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom CA Easytrieve Report Generator 11.6 TechDocsSources: Broadcom TechDocs Getting Started and Programming guides, Advantage CA-Easytrieve Plus Application GuideApplies to: Broadcom Easytrieve Report Generator 11.6, z/OS batch and online