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.
1234567891011* 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.
| Format | Record shape | Beginner notes |
|---|---|---|
| F | Fixed unblocked | One record per physical block; less common on modern disks |
| FB | Fixed blocked | Most common batch layout; LRECL and BLKSIZE both required |
| V | Variable unblocked | Length changes per record; RDW present |
| VB | Variable blocked | Interfaces and logs with varying row length |
| U | Undefined | Tape-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.
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.
12345678910111213FILE 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
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.
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 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.
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.
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.
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.
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.
1. Default FILE type in Easytrieve is:
2. FB(100 1000) on FILE means:
3. JOB INPUT on a sequential file:
4. GET PRIOR on sequential files:
5. Explicit SEQUENTIAL on FILE also enables: