Easytrieve Sequential File Processing

Sequential files are where most Easytrieve beginners start—and where many senior report writers still spend most of their day. Payroll extracts, GL transaction feeds, interface files from distributed systems, and job log summaries usually arrive as QSAM datasets: fixed or variable length records read from first to last. Easytrieve treats sequential as the default FILE type, so FILE PAYDATA FB(200 4000) without a type keyword is already sequential. On z/OS the same declaration can point at a VSAM ESDS when JCL uses AMP='AMORG=VSAM' and you browse forward. This page explains record format choices, automatic JOB INPUT loops, manual GET with EOF guards, PUT for output extracts, PRIOR reads, FILE-STATUS, and how sequential processing differs from indexed KSDS or relative RRDS access. You will finish able to code a complete read-filter-write job without keyed verbs.

Progress0 of 0 lessons

Declaring Sequential Files

text
1
2
3
4
5
6
7
8
9
10
11
* Default sequential — fixed blocked FILE PAYROLL FB(150 1800) * Explicit sequential with status checking FILE TRANSACT SEQUENTIAL FB(80 27920) * Variable blocked extract FILE LOGFILE VB(256 8192) * Output sequential dataset FILE ERRORS FB(150 1800) CREATE

File-name must be unique in the program. The first three characters should differ from the site Easytrieve work file prefix (often EZT) to avoid colliding with sort work datasets. SEQUENTIAL keyword is optional but documents intent and enables FILE-STATUS. FB means fixed-length records blocked together; VB means variable-length with block structure. Match numbers to IDCAMS or catalog listing for the real DSN in JCL.

Record Format Parameters Explained

Sequential record formats on FILE
FormatRecord shapeBeginner notes
FFixed unblockedOne record per physical block; less common on modern disks
FBFixed blockedMost common batch layout; LRECL and BLKSIZE both required
VVariable unblockedLength changes per record; RDW present
VBVariable blockedInterfaces and logs with varying row length
UUndefinedTape-style; rare in new Easytrieve disk jobs

DEFINE field positions assume a logical record layout after the access method strips block overhead. If LRECL is 80 but DEFINE extends to column 90, trailing fields read wrong bytes from the next field or filler. Use consistent copybook layouts from the upstream system that creates the extract.

Automatic Read With JOB INPUT

The simplest sequential batch pattern declares FILE and DEFINE, then starts a JOB activity with JOB INPUT PAYROLL. Each time the job loop cycles, Easytrieve issues the equivalent of a forward GET before your statements run. When the file exhausts, the activity terminates normally and FINISH procedures execute. You write IF conditions against current buffer fields, PRINT detail lines, accumulate totals with ADD or assignment, and PUT to output files. You must not code GET PAYROLL in the same activity while PAYROLL is automatic input—that duplicates reads and fails compile or runtime checks.

text
1
2
3
4
5
6
7
8
9
10
11
12
13
FILE PAYROLL FB(150 1800) FILE HIGHPAY FB(150 1800) DEFINE PAYROLL EMP-NO 9 1 SALARY P 9.2 10 JOB INPUT PAYROLL IF SALARY GT 100000 MOVE EMP-NO TO HIGH-EMP MOVE SALARY TO HIGH-SAL PUT HIGHPAY END-IF

Controlled GET Loops

Use JOB INPUT NULL when you need explicit loop control: read until EOF inside WHILE or repeated GET, process multiple passes, or interleave GET with complex PERFORM structure. After each GET test IF EOF file-name before using fields. Optional STATUS sets FILE-STATUS for branching on I/O errors without aborting the step. GET PRIOR reads the previous record when the access method supports backward retrieval; if position was never established, Broadcom places the last record in the buffer. POINT and GET PRIOR interact with restrictions—do not GET PRIOR after POINT or GET after POINT PRIOR without reading the POINT chapter.

Writing Sequential Output

Output files are sequential unless you declare otherwise. PUT file-name writes the current buffer contents for that file to the dataset—typically after MOVE fields into an output DEFINE layout. JCL must allocate DISP=NEW, MOD, or CATLG per operations standards. CREATE on FILE signals the product may build a new file when disposition allows. Printer output uses FILE name PRINTER instead of disk sequential; REPORT activities format lines to SYSOUT. For extract jobs, one input sequential and one output sequential is the canonical teaching example before introducing keyed masters.

QSAM Versus VSAM ESDS as Sequential

QSAM datasets are plain sequential files on disk or tape. VSAM ESDS is entry-sequenced: records are ordered by insertion, browsed forward with sequential access. Easytrieve FILE SEQUENTIAL with ESDS JCL works for browse-only reporting. Random access by key requires INDEXED and KSDS—not this page. ESDS as sequential suits audit trail scans and log replay. Confirm SHAREOPTIONS and buffer space in IDCAMS match job concurrency; DISP=SHR on input is standard for read-only reports.

FILE-STATUS and Error Handling

When FILE specifies SEQUENTIAL explicitly, FILE-STATUS is available for that file. GET or PUT with STATUS also populates status for branching. Typical pattern: GET INPUT STATUS; IF FILE-STATUS NE 0 handle error. Without STATUS, a bad operating-system status often raises a diagnostic and ends the step. Sequential jobs on tape may hit volume switches; operations handle mount messages outside Easytrieve while your program continues forward reads after remount.

Performance and Buffering

Blocked FB files reduce EXCP counts versus small unblocked records. BLKSIZE should align with track capacity for disk (multiples of LRECL fitting half or full track per site standards). Reading entire file with JOB INPUT is efficient because the runtime buffers aggressively. Writing many small PUT records benefits from sensible block size on OUTFILE. SORT activities spill to work files when data exceeds memory; sequential FILE declarations on sort input and output follow the same FB and VB rules.

Sequential Versus Indexed Decision

Choose sequential when every record must be processed in arrival order, when file size fits one pass, or when the feed is already sorted by needed keys. Choose indexed when random lookups by key dominate—employee master by ID during transaction edit. Hybrid jobs use JOB INPUT sequential transactions and READ on INDEXED master inside job PROC—a pattern covered in multiple-files and indexed pages.

Common Sequential Mistakes

  • Wrong LRECL or BLKSIZE in FILE versus actual dataset.
  • GET on file that is automatic JOB INPUT.
  • No EOF test after manual GET in WHILE loop.
  • PUT without populating output buffer fields first.
  • Using INDEXED READ against QSAM sequential DD.
  • Assuming PRIOR works after POINT without checking rules.

Explain It Like I'm Five

A sequential file is a stack of cards numbered from top to bottom. You take one card off the top, read it, then take the next. JOB INPUT means the computer hands you the next card automatically each time. GET means you reach for the card yourself and must remember to stop when the stack is empty. PUT is putting a new card on another stack you are building. FB means every card is the same size; VB means some cards are longer than others.

Exercises

  1. Code FILE, DEFINE, JOB INPUT for 80-byte FB input filtering on one field.
  2. Rewrite the job with JOB INPUT NULL and GET with IF EOF guard.
  3. Add PUT to write matching records to an output FILE.
  4. Compare when you would use VB instead of FB for an interface file.
  5. Write JCL DD for DISP=SHR input and DISP=NEW output sequential datasets.

Quiz

Test Your Knowledge

1. Default FILE type in Easytrieve is:

  • Sequential
  • Indexed
  • Relative
  • SQL

2. FB(100 1000) on FILE means:

  • Fixed blocked, LRECL 100, block 1000
  • Variable only
  • Indexed key length
  • Printer width

3. JOB INPUT on a sequential file:

  • Auto-reads next record each JOB iteration
  • Opens SQL only
  • Skips DEFINE
  • Disables PUT

4. GET PRIOR on sequential files:

  • Reads previous record when access method supports it
  • Always illegal
  • Only for SQL
  • Only before compile

5. Explicit SEQUENTIAL on FILE also enables:

  • FILE-STATUS for that file
  • Only printer output
  • DLI PCB
  • Macro generation
Published
Read time16 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 SEQUENTIAL FILE and GETSources: Broadcom Easytrieve 11.6 Language Reference FILE SEQUENTIAL, GET, JOB INPUTApplies to: Easytrieve sequential QSAM and ESDS processing