Beginners searching for a LABEL statement in the Broadcom Language Reference will not find a standalone keyword. Easytrieve labels are names you attach to statements and activities so GOTO, PERFORM, and human readers can find logic blocks. A label is the name followed by a period, then the next statement executes as the entry point. This tutorial uses LABEL as the concept name because it appears in statement indexes and parallels COBOL paragraph names, but the mechanics are statement labels and activity labels documented in the Statement Overview chapter. Understanding labels is essential before mastering GOTO, PROC structure, and report event procedures such as BEFORE-LINE. This page teaches naming rules, scope within JOB and PROC, special activity labels, period terminators, comparison with PERFORM modules, and maintainable alternatives to spaghetti branching.
A statement label occupies the statement area before executable code. Broadcom terminates statements with a period followed by a space when another statement follows on the same line. The label itself ends with a period; the statement after the label is where GOTO lands. Labels are not indented like COBOL Area A paragraphs—Easytrieve free form allows labels starting in the statement area per site listing options.
1234567891011121314JOB INPUT PERSNL NAME DIV-LIST IF DIV = 'A' GOTO JOB END-IF IF DIV = 'B' GOTO CHECK-REG-ROUTINE END-IF PRINT DETAIL-RPT CHECK-REG-ROUTINE. IF REGION NE 'EAST' GOTO JOB END-IF PRINT DETAIL-RPT
CHECK-REG-ROUTINE is a statement label. GOTO CHECK-REG-ROUTINE transfers to the IF immediately below the label. GOTO JOB at the top skips the current employee record entirely by branching to the next JOB INPUT cycle. DIV-LIST on the JOB line is an activity label naming that job—not the same as a statement label inside the job, though both use the period convention in different contexts.
| Rule | Detail |
|---|---|
| Maximum length | Up to 128 characters |
| Valid start character | A–Z, 0–9, or national # @ $ |
| Invalid label | Cannot consist entirely of numeric characters |
| Delimiters | Commas, quotes, and other delimiters cannot appear inside the label name |
| DBCS | Double-byte characters permitted where site supports them |
Names like 101-ROUTINE are valid because they are not all numeric. A label named 12345 alone is invalid. Use descriptive names—VALIDATE-ZIP, SKIP-RECORD, AFTER-TAX-CALC—so maintenance programmers recognize purpose without reading every GOTO source.
PROGRAM NAME MYPROG labels the program. JOB INPUT PERSNL NAME PAYROLL labels a job activity. REPORT PAY-RPT names a report subactivity. SCREEN INQUIRY names a screen activity. These activity labels appear on the declaring statement and are referenced by PRINT PAY-RPT, PERFORM procedures, or product-defined hooks. Statement labels live inside the activity body and serve GOTO targets only within that activity or nested PROC unless you explicitly branch across boundaries—which GOTO does not do for arbitrary labels in other activities.
| Label type | Example | Referenced by |
|---|---|---|
| Program | PROGRAM NAME LEDGER | CALL, linker, listings |
| JOB activity | JOB INPUT FILE-A NAME BATCH1 | Multiple JOB blocks, documentation |
| PROC | CALC-TAX. PROC | PERFORM CALC-TAX |
| Statement | ERROR-HANDLER. | GOTO ERROR-HANDLER |
| REPORT | REPORT SUMMARY-RPT | PRINT SUMMARY-RPT |
GOTO label requires the label in the same activity or PROC as the GOTO. You cannot GOTO a label in a different JOB from another JOB. PROC labels are local to the PROC when branching inside it; PERFORM enters the PROC at the first statement after the PROC label without using GOTO. GOTO JOB and GOTO SCREEN are special forms branching to activity tops—not arbitrary labels. GOTO SCREEN runs BEFORE-SCREEN again; GOTO JOB skips to the next input record cycle.
A PROC begins with name PROC and ends with END-PROC. The PROC name acts as a label for PERFORM invocation. Code inside the PROC may contain additional statement labels for internal GOTO. BEGINNERS sometimes duplicate a PROC name as an internal label—avoid confusion by keeping PROC entry logic immediately after the PROC line without a redundant label unless GOTO must target mid-PROC logic.
12345678910111213TAX-CALC. PROC IF STATE = 'TX' GOTO TEXAS-RATE END-IF RATE = FED-PCT GOTO APPLY-RATE TEXAS-RATE. RATE = TX-PCT APPLY-RATE. TAX = GROSS * RATE END-PROC
Easytrieve allows multiple statements on one line when each ends with period and space. A label line often contains only the label and period. Do not omit the period after a label; without it the compiler may treat the label as part of the next statement keyword and fail. Continuation lines use hyphen or plus at end of statement area per syntax rules—labels themselves do not continue across lines.
Broadcom structured programming guidance recommends IF, ELSE, DO WHILE, and PERFORM instead of deep GOTO webs. Labels remain appropriate for GOTO JOB record skips, centralized error handlers invoked from many IF branches, and legacy patterns you must preserve during migration. New code should default to PERFORM PROC for reusable modules and nested IF for two-way decisions.
Report PROCs and screen procedures use special-name labels such as BEFORE-LINE. PROC and INITIATION are not arbitrary user labels—they are product-reserved procedure names. User statement labels inside REPORT PROCs follow the same GOTO scope rules within that PROC. Mixing report event procedure names with custom labels causes compile errors if you misspell a reserved hook name.
A label is a sticky note on a line of your program that says jump here. When GOTO says go to CHECK-REG-ROUTINE, the computer finds that sticky note and runs the next instruction under it. Activity names like JOB PAYROLL are bigger sticky notes on whole chapters. You cannot jump to a sticky note in someone else's book chapter unless the rules say you stay in the same chapter. PERFORM is like calling a helper who comes back when done; GOTO is like jumping without automatic return.
1. A statement label in Easytrieve is written as:
2. GOTO CHECK-REG transfers control to:
3. A valid label name may:
4. GOTO JOB branches to:
5. Structured flow guidance favors: