PARM, FILE, and JOB do not belong in interchangeable positions. An Easytrieve source member follows a defined order: optional Environment settings, Library declarations, and then one or more processing activities.
Easytrieve program structure at a glance
The Easytrieve program structure has three sections. Environment is optional. Library is technically optional but appears in most file-processing and reporting programs. Activity is required because it contains the work the program performs.
| Section | Typical statements | Purpose |
|---|---|---|
| Environment | PARM | Changes compiler or runtime options for this program. |
| Library | FILE, field declarations, DEFINE | Describes input, output, record layouts, and working fields. |
| Activity | JOB, SORT, executable statements, procedures, REPORT | Reads and processes data, writes files, sorts records, and produces reports. |
The Easytrieve Plus tutorial owns the general introduction, execution JCL, and first report. This page concentrates on source layout and statement placement.
Canonical statement order
A batch report normally follows this outline. Bracketed lines are optional; they show placement rather than literal Easytrieve syntax.
One source member can contain multiple JOB and SORT activities. They share the declarations that precede them, but each activity has its own input choice, statements, procedures, and optional reports.
Environment section: optional PARM settings
The Environment section begins with a PARM statement and must come first when used. PARM changes options for the source member, such as listing, debugging, linking, work-space, or interface behavior supported by the installed release.
This example requests listing information on systems that support those operands. Option names and defaults can be controlled by the site's Easytrieve release and option table, so copy the PARM syntax from the documentation and procedures installed at the shop.
PARM, not PRAM. A PARM statement placed after FILE or JOB is also in the wrong section.Library section: files, fields, and working storage
The Library section is the program's data-definition area. A FILE statement names an input or output file and supplies file attributes. Field declarations map bytes in that record. DEFINE statements create working-storage fields or define fields independently from a file layout.
EMP-NAME begins at position 17 and occupies 20 alphanumeric bytes. GROSS is a four-byte packed field with two decimal positions. The Easytrieve field-definition guide explains position, length, type, decimals, headings, and masks.
The FILE name normally maps to a JCL DD name on z/OS. If the source says FILE PERSNL, the execution step usually needs a PERSNL DD unless the site uses another mapping rule. For keyed data, the Easytrieve VSAM guide covers file definition, status handling, and I/O statements.
Activity section: JOB and SORT
The Activity section contains executable processing. A JOB activity can read files, test and change data, write output files, and initiate reports. A SORT activity creates an ordered output file from sequentially processable input.
With automatic input, Easytrieve handles the ordinary open, read, end-of-file, and close cycle. The statements below JOB run for each available record. The Easytrieve JOB statement guide covers automatic input, INPUT NULL, activity names, STOP, and FINISH. Condition syntax belongs to the Easytrieve IF and ELSE guide.
Where procedures belong
A procedure begins with a named PROC statement and ends with END-PROC. JOB procedures are coded after the JOB's executable statements and before its report subactivities. Report procedures belong with the report they serve.
Broadcom documents error EZTC0168E when a label is coded after Easytrieve's implied return to JOB and therefore sits in an invalid location. Keep procedures and labels inside the valid activity region; add an explicit GO TO JOB only when the program's intended control flow requires it.
REPORT is part of the Activity section
REPORT PAY-RPT begins a report subactivity. It follows the JOB statements and any JOB procedures that feed it. TITLE, LINE, SEQUENCE, CONTROL, and report-specific procedures describe how records selected by PRINT are formatted.
Do not repeat JOB INPUT on a REPORT line. The old version of this post blended JOB and REPORT syntax into a duplicate line, which obscured the actual boundary between processing logic and report definition.
For detailed report syntax, use the Easytrieve basic reporting guide. The reporting page owns TITLE, LINE, headings, and output layout; this page owns where the REPORT block sits in the source member.
Complete annotated program skeleton
This small program reads PERSNL, selects department 911, and formats one report. It omits Environment settings because none are required for the example.
The Library section supplies every field referenced by the JOB and REPORT. PRINT transfers the selected detail data to PAY-RPT, and the REPORT declaratives determine its presentation. Compile this sample against the site's record layout before using it with production data.
How source sections map to execution
| Source element | Compile-time role | Runtime effect |
|---|---|---|
PARM | Selects supported program options. | Can affect listing, debugging, work files, linking, or interfaces. |
FILE and fields | Build the data descriptions used to validate later references. | Connect source names to input, output, and record storage. |
JOB INPUT PERSNL | Defines an activity and its input method. | Runs activity statements for the automatic-input record cycle. |
PRINT PAY-RPT | Associates selected data with a named report. | Passes a report detail occurrence for later formatting. |
REPORT PAY-RPT | Defines the report subactivity. | Formats titles, lines, control breaks, totals, and sequence as coded. |
Report processing can use Easytrieve's Virtual File Manager when sequencing or multiple-report handling requires work storage. The execution JCL must provide the DD names and work resources required by the site's cataloged procedure.
Multiple activities in one source member
A program can contain more than one JOB or SORT activity. This allows one set of Library declarations to support several passes or outputs, but it also makes source boundaries more important.
- Give each JOB a meaningful NAME when diagnostics or references benefit from it.
- Keep each JOB's procedures and reports adjacent to that activity.
- Remember that STOP ends the current activity through normal termination processing, while
STOP EXECUTEends execution immediately and can prevent deferred reports from being produced. - Define every output file in Library and supply its corresponding DD statement.
Broadcom examples show multiple JOB activities writing separate outputs in one program. The Easytrieve macros guide is useful when repeated definitions or statement patterns should be maintained once and invoked consistently.
Common structure and placement errors
| Symptom | Likely structural cause | Check |
|---|---|---|
| PARM is rejected | It appears after Library or Activity source, or contains a typo or unsupported operand. | Place PARM first and check the installed reference. |
| Field name is undefined | The field is absent, misspelled, or declared after the activity that references it. | Move or correct the declaration in Library. |
| Label not defined | The label is outside the valid JOB region after an implied activity return. | Review procedure placement and control flow. |
| Report name is undefined | PRINT names a report that has no matching REPORT subactivity. | Match the names exactly and place REPORT after JOB logic. |
| Input file does not open | The FILE name and JCL DD name or attributes do not agree. | Compare source declarations with execution JCL and catalog data. |
| Deferred report is missing | STOP EXECUTE terminated before report processing completed. | Use STOP for normal activity termination when appropriate. |
Official references
- IBM Migration Utility: Structure of Easytrieve programs
- IBM Migration Utility: Order of statements in an Easytrieve program
- Broadcom: EZTC0168E label placement
- Broadcom: Multiple output files and JOB activities
- Broadcom: STOP and STOP EXECUTE behavior
Frequently asked questions
What are the three sections of an Easytrieve program?
The sections are Environment, Library, and Activity, in that order. Environment holds optional PARM settings, Library describes files and fields, and Activity contains JOB or SORT processing plus related procedures and reports.
Is the Easytrieve Environment section required?
No. It is optional. If PARM settings are needed, the Environment section must appear before Library and Activity source.
Where is an Easytrieve REPORT definition coded?
A REPORT definition is a subactivity within the Activity section. For a JOB, code executable statements and job procedures before the associated REPORT definition and its report procedures.
Can one Easytrieve program contain multiple JOB activities?
Yes. A source member can contain multiple JOB and SORT activities. Each activity has its own input, processing logic, procedures, and optional report definitions, while sharing Library declarations.
No comments:
Post a Comment