START positions an indexed or relative VSAM file so subsequent sequential reads can walk forward or backward from a chosen point. In KSDS batch, teams use START plus READ NEXT to print every customer whose ID is greater than or equal to a report threshold, to walk all duplicates sharing a non-unique key, or to restart a long sequential pass after checkpointing the last processed key. START does not fetch a row by itself; pairing it with the wrong READ form is a frequent defect where programmers expect random READ semantics and instead receive sequencing surprises. This page explains KEY IS relational operators at a beginner level, INVALID KEY handling, the interaction with ACCESS IS DYNAMIC, and operational cautions about holding position while other jobs insert keys nearby under duplicate-allowed definitions.
| Operator | Intent |
|---|---|
| = | Position at the first record whose key equals the value you moved into RECORD KEY before START. |
| > | Position after the key value for strictly greater browse starting points. |
| >= | Position at or after the key value; useful for range reports that include the boundary key. |
| < / <= (where supported) | Backward or low-bound positioning patterns depend on compiler and ACCESS options—verify before use. |
Exact support for less-than comparisons and READ PREV pairing depends on compiler options, VSAM capabilities, and ACCESS MODE. Rather than memorizing edge cases from a blog, build a matrix in your team wiki after running controlled tests on the LPAR version you ship to production. That matrix becomes the authoritative answer when two senior developers disagree during code review.
1234567891011121314MOVE REPORT-START-KEY TO CUST-KEY START CUSTFILE KEY IS NOT LESS THAN CUST-KEY INVALID KEY MOVE 'Y' TO DONE-FLAG END-START PERFORM UNTIL DONE-FLAG = 'Y' READ CUSTFILE NEXT AT END MOVE 'Y' TO DONE-FLAG END-READ IF DONE-FLAG NOT = 'Y' PERFORM PROCESS-CUST-RECORD END-IF END-PERFORM
Phrases like KEY IS NOT LESS THAN map to the >= style intent in English; COBOL uses reserved words instead of symbols in many formats. Replace with the exact START phrase your compiler accepts—some shops generate these lines from macros to avoid hand typos. The sample mixes START INVALID KEY with AT END on READ NEXT; unify FILE STATUS style if your standards forbid mixed paradigms.
NONUNIQUEKEY clusters allow multiple rows with the same primary key value. START with equality positions you at the first duplicate in VSAM order; subsequent READ NEXT walks the duplicate chain until the key changes. Programs must decide when to stop: after business columns differ, after a count limit, or after crossing a high boundary key you store in working storage. Failure to document that behavior causes report totals that disagree with SQL extracts built on distinct-key assumptions.
Wide scans that START low and READ NEXT for millions of rows stress sequential prefetch paths; tune CI size, BUFND, and job priority with measurement. Narrow scans that START near the high end of the file still pay index descent cost once per START; avoid placing START inside an inner loop when the key does not change—that pattern multiplies positioning overhead unnecessarily.
DYNAMIC access allows the runtime to switch between sequential and random styles. START establishes a sequential cursor context from a key boundary, while later random reads may still be legal depending on usage. Mixing styles without a state diagram invites defects. Draw your intended state machine on paper: after START, which reads are NEXT, which are random by key, and where you reset with another START. Reviewers thank you for the diagram during audits more than they thank you for clever paragraph names.
START KEY IS EQUAL when no record matches typically triggers INVALID KEY or a not-found status. Some programs mistakenly treat that as fatal for the whole job when the business meaning is simply “no rows in this optional sub-section.” Encode business rules explicitly: optional sections should branch to empty-report printing rather than ABEND when START fails cleanly with documented codes.
Backward browse using READ PREV appears in maintenance utilities that walk duplicates backward or reverse daily batches. Availability depends on compiler, VSAM, and ACCESS declarations. If your mentor says “we do not use READ PREV here,” believe them and avoid cargo-culting examples from other companies. When it is supported, you still anchor with START and then walk backward with disciplined AT END or status handling symmetrical to forward scans.
START is placing your bookmark at the first dictionary page that matches “start at words beginning with M.” READ NEXT is turning pages forward one at a time from that bookmark. If no words begin with M, the librarian shakes their head—INVALID KEY. If you forget to turn pages after placing the bookmark, you never actually read any words.
1. START establishes position; which verb usually retrieves the first data row afterward?
2. START with KEY IS = and no matching key typically triggers:
3. START is most associated in class labs with: