GOTO modifies the natural top-to-bottom flow of Easytrieve statements. You can branch to a named label inside the same activity or procedure, to the top of the current JOB activity (GOTO JOB), or to the top of the current SCREEN activity (GOTO SCREEN). The synonym GO TO is accepted. GOTO JOB is the everyday batch pattern for skipping a record after validation fails—control returns to the JOB loop for the next automatic input record without re-executing START. GOTO SCREEN refreshes online flow including BEFORE-SCREEN but not INITIATION, and it is illegal inside BEFORE-SCREEN. Labels follow naming rules similar to other Easytrieve names: up to 128 characters, not all numeric, starting with letter, digit, or national character. Structured programming favors IF, DO, and PERFORM, but GOTO JOB remains idiomatic and documented for record bypass. This page covers syntax, label placement, JOB and SCREEN targets, START/FINISH interactions, and safer patterns so beginners do not invent spaghetti branches across activities.
123456789101112131415{GOTO | GO TO} {label | JOB | SCREEN} * Skip bad record in batch: IF PAY-GROSS NOT NUMERIC DISPLAY EMP# ' DAMAGED' GOTO JOB END-IF * Branch to a label inside a PROC: IF CURR-MM NE HIRE-MM GOTO QUIT-SERV-CALC END-IF ... QUIT-SERV-CALC * next statements...
| Target | Effect | Important notes |
|---|---|---|
| label | Jump to first statement after that label; then continue top-to-bottom | Label must be in same activity or procedure |
| JOB | Immediate branch to top of current JOB activity | Does not run START; in START/FINISH it terminates that procedure |
| SCREEN | Branch to top of current SCREEN including BEFORE-SCREEN | Skips INITIATION; invalid in BEFORE-SCREEN; in TERMINATION ends screen |
A statement label is itself a complete statement. You place it before executable statements such as assignment, CASE, GET, IF, PERFORM, PRINT, READ, STOP, WRITE, and many others listed in the Broadcom GOTO article. Labels may be up to 128 alphanumeric characters, may contain characters other than delimiters, may begin with A–Z, 0–9, or national characters (#, @, $), and must not be all numeric. After GOTO label, processing continues from the labeled point downward—there is no automatic return like PERFORM provides.
GOTO JOB is the standard way to abandon remaining logic for the current automatic input record and fetch the next. It does not include execution of the START procedure. Typical uses: reject non-numeric amounts, skip inactive departments, bypass records outside a date range after DISPLAY of a warning. Inside a START procedure, GOTO JOB terminates START (you are not requesting another full START cycle). Inside FINISH, GOTO JOB terminates FINISH early—usually undesirable if FINISH prints totals, so avoid casual GOTO JOB in FINISH.
1234567JOB INPUT PERSNL NAME MYPROG IF DEPT LT 900 GOTO JOB END-IF PRINT RPT REPORT RPT LINE EMP# NAME-LAST DEPT
Records with DEPT less than 900 never reach PRINT. The JOB activity continues until automatic input is exhausted. This is clearer than deeply nested ELSE trees when many independent skip reasons exist—each reason can GOTO JOB after its own message.
GOTO SCREEN branches to the top of the current SCREEN activity and runs BEFORE-SCREEN again, but does not run INITIATION. Use it from AFTER-SCREEN or other allowed points when the user must see a rebuilt screen after edits. Restrictions matter:
Confusing GOTO SCREEN with REFRESH or RESHOW causes subtle online bugs—those verbs have their own rules and are also restricted in BEFORE-SCREEN. See BEFORE-SCREEN and AFTER-SCREEN tutorials.
PERFORM name runs a PROC and returns. GOTO label transfers without return. Application Guide samples often GOTO a local label to exit early from a calculation PROC (for example QUIT-SERV-CALC) then fall into END-PROC. That pattern is acceptable when the label sits in the same PROC. Jumping into the middle of another PROC or across JOB activities is not supported—the label must stay in the same activity or procedure. Prefer PERFORM for reusable logic; prefer GOTO JOB for record bypass; use local labels sparingly for early exits inside one PROC.
Broadcom structured-programming guidance emphasizes IF/ELSE/ELSE-IF, DO loops, and consistent indentation. GOTO is not banned, but nesting many label jumps makes maintenance hard. A practical beginner policy:
123456789IF PAY-GROSS NOT NUMERIC DISPLAY EMP# ' PERSONNEL RECORD IS DAMAGED' GO TO JOB END-IF IF PAY-GROSS > 500.00 XMAS-BONUS = PAY-GROSS * 1.03 ELSE XMAS-BONUS = PAY-GROSS * 1.05 END-IF
The first IF uses GO TO JOB so damaged records never compute bonuses. Control never returns to the statements after GOTO—exactly what you want for reject paths.
Easytrieve normally reads your instructions from top to bottom like a story. GOTO is a sticky note that says “jump to this page.” GOTO JOB means “skip the rest of this card and take the next card from the deck.” GOTO SCREEN means “draw the online form again from the start of the form loop.” Labels are page bookmarks inside the same chapter—you cannot jump to a bookmark in a different book.
1. GOTO JOB branches to:
2. A GOTO label must be:
3. GOTO SCREEN cannot be coded in:
4. GO TO is:
5. GOTO JOB inside START procedure: