Sunday, 28 July 2013

Easytrieve Plus Tutorial: FILE, JOB, REPORT, and JCL

FILE, JOB, PRINT, REPORT, and LINE are enough to build a useful Easytrieve Plus report. A short program can read a fixed-length file, select records, and format a listing without the amount of source normally required for the same report in COBOL.

Easytrieve Plus tutorial flow from FILE to JOB to REPORT to OUTPUT
Define the file, process records, then format the output.

What is Easytrieve Plus?

Easytrieve Plus is a mainframe data-processing and report-generation language. Teams use it for batch listings, extracts, reconciliations, file maintenance, summaries, and small conversion jobs. It combines record definitions, procedural logic, and report formatting in one source member.

The product is often called Easytrieve, Easytrieve Plus, or Easytrieve Report Generator. Product names and available features vary by release, so check the procedure and manuals installed at your site before copying syntax into production.

Good first use case: read a personnel file, select one department, and print employee number, name, and gross pay. That exercise covers the main program flow without hiding the logic inside a large example.

Where Easytrieve fits on a mainframe

Easytrieve is strongest when the work is record-oriented and the result is a report or extract. Broadcom examples show automatic input processing for flat files and VSAM, and an optional interface can read Db2 tables. Easytrieve also handles working fields, conditional logic, sorting, control breaks, totals, and formatted report columns.

RequirementEasytrieve fitReason
Daily exception reportStrongRecord selection and report formatting stay in a compact program.
One-time file reconciliationStrongInput layouts, comparisons, and printed differences can be coded together.
VSAM or Db2 extractSite dependentThe required access method or licensed interface must be available.
Large online transaction applicationUsually weakCOBOL and CICS normally provide the structure and operational model needed for long-lived transaction code.

Easytrieve program flow

A beginner program normally has three logical parts. The library section defines files and fields. The job activity reads records and applies processing rules. The report section formats the records selected by PRINT.

1. Define the input file and fields

The FILE statement names the input source. Field definitions identify the starting position, length, and data type inside each record.

FILE PERSNL F(150)
     DEPT        1   3 N
     EMPNO       9   5 N
     NAME       17  20 A
     GROSS      94   4 P 2

A defines an alphanumeric field, N defines numeric display data, and P defines packed decimal data. The final 2 on GROSS supplies the number of decimal positions. Confirm every offset against the real copybook or file layout; a one-byte error can make valid EBCDIC data look corrupt.

2. Process records in the JOB activity

JOB INPUT PERSNL requests automatic input processing. Easytrieve reads each record from PERSNL and runs the statements in the activity. This example prints only department 910.

JOB INPUT PERSNL
    IF DEPT = 910
        PRINT DEPTRPT
    END-IF

The PRINT statement does not define the layout. It sends the current record to the named report. Keep the report name consistent or the source will fail during syntax checking.

3. Format the report

The REPORT statement begins the layout. TITLE defines the report title, HEADING replaces default field headings, and LINE lists the fields printed on each detail line.

REPORT DEPTRPT LINESIZE 100
    TITLE 1 'DEPARTMENT 910 EMPLOYEES'
    HEADING EMPNO ('EMPLOYEE' 'NUMBER')
    HEADING GROSS ('GROSS' 'PAY')
    LINE DEPT EMPNO NAME GROSS

Broadcom publishes the same core pattern in its Easytrieve examples: define the input, run a JOB activity, issue PRINT, and describe the report with REPORT, TITLE, and LINE.

Complete Easytrieve Plus example

The following source combines the definitions, record selection, and report layout. Replace positions and lengths with the values used by your input file.

FILE PERSNL F(150)
     DEPT        1   3 N
     EMPNO       9   5 N
     NAME       17  20 A
     GROSS      94   4 P 2

JOB INPUT PERSNL
    IF DEPT = 910
        PRINT DEPTRPT
    END-IF

REPORT DEPTRPT LINESIZE 100
    TITLE 1 'DEPARTMENT 910 EMPLOYEES'
    HEADING EMPNO ('EMPLOYEE' 'NUMBER')
    HEADING GROSS ('GROSS' 'PAY')
    LINE DEPT EMPNO NAME GROSS

For a closer explanation of library, activity, and report sections, use the Easytrieve program structure tutorial. The separate Easytrieve basic reporting guide covers report statements in more detail.

Run Easytrieve from JCL

Many sites provide a cataloged procedure that runs the Easytrieve translator and runtime. The procedure name, program name, load libraries, source DD name, and work files are installation choices. Do not assume that a sample procedure from another company will run unchanged.

//EZTRPT   JOB ...
//STEP1    EXEC PROC=your-site-easytrieve-proc
//PERSNL   DD  DSN=your.input.personnel,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
  ... Easytrieve source here ...
/*

If your procedure expects the source on a DD name other than SYSIN, follow the installed procedure. The PERSNL DD name must match the FILE PERSNL definition. Review SYSPRINT after every test for syntax messages, file allocation failures, and the final return code.

Production check: inspect the expanded JCL in JES before changing STEPLIB, source, or work-file DD statements. The cataloged procedure tells you which runtime your job actually uses.

Files and databases Easytrieve can process

Broadcom states that Easytrieve can read, write, and update standard IBM flat files, VSAM, and several database sources on the mainframe. Db2 access requires the appropriate licensed interface. A job that reads VSAM also needs the correct file organization, key definition, DISP, and sharing options.

Use the Easytrieve VSAM file handling guide for PUT, STATUS, and FILE-STATUS patterns. For field positions and data types, see Easytrieve field definitions.

Easytrieve Plus and COBOL compared

Choose Easytrieve when a small team needs a clear report, extract, or file check and the language is supported at the site. Its automatic input and report facilities remove much of the control code required for a simple batch listing.

Choose COBOL when the application contains many modules, shared copybooks, complex recovery rules, long-lived business logic, or online CICS processing. Maintainability depends more on local skills, tests, and standards than on source-line count.

Common Easytrieve beginner errors

  • Wrong field position: output shows unexpected characters because a definition starts one byte early or late.
  • Wrong data type: packed, binary, zoned, and alphanumeric data are not interchangeable.
  • Missing DD statement: the FILE name exists in the source but the JCL does not allocate the matching DD name.
  • Unknown report name: PRINT DEPTRPT points to a missing or differently spelled REPORT.
  • Line overflow: the fields on LINE need more print positions than LINESIZE permits.
  • Site-specific syntax: a statement copied from another release or compatibility mode is not accepted by the installed runtime.

Easytrieve Plus learning path

  1. Run one fixed-file listing with no selection logic.
  2. Add an IF condition and confirm the record count.
  3. Add headings, masks, totals, and a control break.
  4. Move reusable definitions into the site library only after the standalone source works.
  5. Study Easytrieve report calculations and Easytrieve macros after the basic report is stable.

Official Easytrieve references

Easytrieve Plus FAQ

What is Easytrieve Plus used for?

Easytrieve Plus is used for batch reporting, file selection, extracts, summaries, data checks, and small file-processing jobs on mainframe systems.

Does Easytrieve Plus replace COBOL?

No. Easytrieve is a good fit for compact reporting and data-processing jobs. COBOL is usually a better choice for large applications, complex transaction logic, and code that needs extensive modular design.

Can Easytrieve read VSAM and Db2 data?

Easytrieve can process flat files and VSAM. Db2 access depends on the licensed interface and the standards installed at your site.

How is an Easytrieve program run in JCL?

Sites normally provide a cataloged procedure or execution step that points to the Easytrieve runtime libraries. Supply the source through the DD name required by that procedure and add DD statements for every input and output file.

Start with one real input layout and make the first report match its record positions exactly; every later Easytrieve feature depends on that definition being correct.

No comments:

Post a Comment

New In-feed ads