Every Easytrieve activity must end somehow. JOB activities with automatic INPUT stop when the file reaches end-of-file—implied flow runs FINISH, wraps reports, and advances to the next activity. But real programs exit early when validation fails, when a control file is empty, when an operator presses Exit, or when a NULL-input JOB finishes its manual GET loop. STOP is the primary verb for premature activity termination. STOP alone ends the current activity in an orderly way: complete spooled reports where applicable, run FINISH on JOB, commit recoverable work when COMMIT ACTIVITY applies, then let subsequent activities run. STOP EXECUTE is the emergency brake—it aborts all Easytrieve processing immediately, skips FINISH, rolls back recoverable resources, and leaves no further JOB or SORT to execute. SORT BEFORE procedures use STOP to end prescreening and launch the sort pass. SCREEN activities compile only when EXIT, STOP, or TRANSFER appears somewhere. This page teaches STOP syntax, context-specific behavior in JOB SORT SCREEN and procedures, interaction with SELECT and FINISH, COMMIT and ROLLBACK pairing, and 11.6 syntax differences from legacy releases.
1STOP [EXECUTE]
Two forms: STOP ends the current activity; STOP EXECUTE ends the entire program run. On Easytrieve 11.6 use STOP EXECUTE—not legacy STOP (EXECUTE) parentheses form from 6.4, which errors on modern compilers. No other operands appear on STOP.
| Form | Scope | FINISH procedure | Recoverable work |
|---|---|---|---|
| STOP | Current activity only | Runs on JOB when coded | COMMIT when COMMIT ACTIVITY specified |
| STOP EXECUTE | All activities immediately | Skipped | ROLLBACK |
| EOF (automatic) | Current JOB ends naturally | Runs when coded | Per COMMIT options |
| EXIT (SCREEN) | Normal SCREEN end | N/A for JOB FINISH | Per SCREEN COMMIT |
Automatic INPUT JOB activities terminate at EOF without explicit STOP. Use STOP when business logic must quit before EOF—fatal edit on first record, empty control file after START, operator threshold exceeded. STOP completes outstanding reports for that JOB and executes FINISH when FINISH procedure is coded. GOTO JOB is not STOP—it skips to next record iteration. STOP leaves the read loop entirely.
JOB INPUT NULL has no automatic EOF. Every NULL job must reach STOP or TRANSFER or it loops forever consuming CPU. Pattern: DO WHILE manual GET, process, IF EOF STOP. Test NULL jobs carefully in development—missing STOP is a classic runaway job ticket.
123456JOB INPUT NULL NAME MANUAL-READ GET SECFILE IF EOF SECFILE STOP END-IF * process SECFILE record
Broadcom example: FINISH procedure tests RECORD-COUNT = 0, DISPLAYs error messages, then STOP EXECUTE when input file was unavailable—preventing a useless SORT and second JOB from running in the same program. STOP EXECUTE in FINISH aborts before subsequent activities execute—critical in multi-activity sources where later JOB assumes prior activity produced data.
1234567891011121314JOB INPUT INVENT NAME MYPROG1 FINISH FINISH-PROC PRINT MYREPORT FINISH-PROC. PROC IF RECORD-COUNT = 0 DISPLAY 'INPUT FILE NOT AVAILABLE' DISPLAY 'HALTING EXECUTION...' STOP EXECUTE END-IF END-PROC SORT INVENT TO SORTWRK USING (LOCATION-STATE, LOCATION-CITY) JOB INPUT SORTWRK NAME MYPROG2 PRINT MYREPORT
STOP in a SORT prescreen procedure terminates record selection and invokes the sort program. Use it to cap records sorted—first fifty only example—or when input order signals early end. If you SELECT a record and later STOP in the same procedure invocation, that record is not selected. Plan SELECT/STOP ordering when mixing inclusion flags with early prescreen exit.
STOP coded inside START or FINISH terminates that procedure—not always the entire JOB unless STOP propagates per context. STOP EXECUTE inside FINISH aborts all execution. Plain STOP inside START ends START procedure early; JOB may continue to input processing depending on surrounding logic. Read Broadcom JOB GOTO rules alongside STOP when mixing control verbs in lifecycle procedures.
SCREEN activities require EXIT, STOP, or TRANSFER so compile succeeds. EXIT is normal end; STOP ends the SCREEN activity and may chain to batch activities depending on PROGRAM flow. KEY F3 NAME 'Exit' EXIT is idiomatic online. STOP on SCREEN from PF key is valid when designers want shared semantics with batch STOP in hybrid programs.
Explicit PROGRAM activities end when statements complete, or when STOP, STOP EXECUTE, or TRANSFER runs. PROGRAM must EXECUTE other activities—STOP after last EXECUTE ends driver. STOP EXECUTE from PROGRAM prevents further EXECUTE of downstream SORT/JOB even if source order lists more activities.
When COMMIT ACTIVITY is specified on the activity statement, STOP causes commit of recoverable work. STOP EXECUTE causes rollback. Online SCREEN COMMIT TERMINAL settings interact with pseudo- conversational CICS—coordinate STOP with operational transaction design so partial updates are not left uncommitted or over-committed relative to shop standards.
Activities do not use END-JOB keywords—next JOB or SORT activity implicitly ends the prior one at normal batch flow boundaries. STOP is explicit early exit within an activity. TRANSFER passes control to another context per release rules—do not interchange with STOP without reading TRANSFER documentation. END-IF END-DO END-PROC close blocks—they do not end activities.
STOP is telling the teacher we are done with this worksheet now—put away your pencil, hand in what you finished (that is FINISH and reports), and move to the next subject if there is one. STOP EXECUTE is pulling the fire alarm for the whole school day—everyone goes home immediately, nothing else on the schedule runs, and undone work gets erased (rollback). You need STOP on manual worksheets (NULL jobs) because the teacher will not say time is up unless you raise your hand.
1. STOP without EXECUTE:
2. STOP EXECUTE:
3. JOB INPUT NULL requires STOP because:
4. STOP in JOB body normally:
5. SELECT then STOP in sort procedure: