Easytrieve Paragraphs

COBOL programmers speak in paragraphs; Easytrieve programmers speak in labels, PROCs, and activities. The word paragraph in Easytrieve tutorials usually means a named block of logic inside an activity—a set of statements that implement one business rule group, often entered through a statement label and sometimes reached with GOTO. Unlike formal PROC modules, paragraphs in this sense are lightweight organizational units. Understanding when to use labels, when to upgrade logic into PERFORM PROCs, and when GOTO JOB skips a record helps you read legacy source and write clearer new programs.

Progress0 of 0 lessons

Paragraphs as Labeled Logic Blocks

Within a JOB or PROGRAM activity, you can place a statement label on its own line before a group of related statements. The label acts as a paragraph name. Other statements use GOTO label to transfer control there. Labels identify PROGRAMs, JOBs, PROCs, REPORTs, SCREENs, and individual statement groups per Broadcom labeling rules. A label can be up to 128 characters, must not be all numeric, and cannot contain delimiter characters.

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
JOB INPUT PERSNL NAME DIV-LIST IF DIV EQ 'A' GOTO JOB END-IF IF DIV EQ 'B' GOTO CHECK-REGION END-IF PRINT DETAIL-RPT CHECK-REGION IF REGION EQ 'NE' GOTO JOB END-IF PRINT DETAIL-RPT

CHECK-REGION is a paragraph entry point. When DIV is B, GOTO CHECK-REGION skips generic processing and runs region validation. GOTO JOB sends control back to the top of the JOB activity—typically to read the next record—without executing trailing statements for the current record. This pattern filters records early.

Paragraphs vs PROC Modules

Labels/paragraphs compared with PROCs
AspectLabeled paragraphPROC module
EntryStatement labelproc-name. PROC
InvocationGOTO labelPERFORM proc-name
ReturnManual branch or fall-throughAutomatic at END-PROC
Best forLocal branching within linear flowReusable callable tasks

If the same block is needed from multiple places, a PROC with PERFORM is usually cleaner than multiple GOTO lines pointing to one label. If you need to abandon the current record immediately, GOTO JOB is idiomatic. Paragraph-style labels still help readability even when no GOTO references them—reviewers see CHECK-REGION as a named section.

Activity-Level Paragraphs

The Activity section as a whole can contain many paragraph-like tasks: validation, calculation, extract write, and report trigger. Mainframe training material often calls each task a paragraph even when implemented as straight-line IF logic without labels. Modular thinking matters more than the keyword. Group statements visually with blank comment lines and consistent indentation so each business rule reads as its own paragraph block.

GOTO Variants

GOTO accepts a user label, GOTO JOB, or GOTO SCREEN. GOTO JOB jumps to the top of the current JOB activity—useful to stop processing the current input record. GOTO SCREEN restarts the current SCREEN activity including BEFORE-SCREEN processing in online programs. GO TO is accepted as a synonym for GOTO. Labels referenced by GOTO must reside in the same activity or PROC as the GOTO statement.

Structured Alternatives

Broadcom structured programming guidance promotes IF/ELSE, DO WHILE, DO UNTIL, CASE, and PERFORM instead of dense GOTO webs. Indent nested IF blocks so paragraph structure is visible without labels. Compare poorly indented flat IF chains with indented equivalents in the structured programming documentation—the logic is identical but maintenance cost differs. Modernize legacy GOTO paragraphs gradually by extracting PERFORM PROCs while preserving behavior with regression tests.

Paragraphs in REPORT and SCREEN Contexts

Report PROCs such as BEFORE-LINE behave like event-driven paragraphs the report writer calls automatically—they are not reached by your GOTO. SCREEN activities use INITIATION, BEFORE-SCREEN, and AFTER-SCREEN PROCs similarly. When documentation says paragraph in reporting context, it may mean these special PROC hooks rather than user labels. Context determines which mechanism applies.

Label Naming Conventions

  • Use descriptive names: VALIDATE-DATE, SKIP-INACTIVE, not LABEL1.
  • Prefix region-specific logic consistently across programs at your shop.
  • Avoid labels that look like field names unless qualified—confusion at compile time.
  • Document GOTO JOB exits so readers know record processing stops intentionally.

Reading Legacy Paragraph Style Code

Older Easytrieve programs may chain many GOTO targets across hundreds of lines. Trace flow by drawing arrows from each GOTO to its label. Identify unreachable statements after unconditional GOTO. Check whether a label is only used once—candidate for inline IF logic or a PROC. SYSPRINT compile listings show statement numbers that pair with DEBUG STATE when runtime issues appear in labeled sections.

Common Mistakes

  1. GOTO to a label in a different activity—compile error or undefined target.
  2. Forgetting that GOTO JOB skips remaining logic for the current record.
  3. Duplicating paragraph bodies instead of PERFORM a shared PROC.
  4. Labels consisting of all digits—invalid per Broadcom rules.
  5. Spaghetti GOTO that newer maintainers cannot safely change.

Explain It Like I'm Five

Imagine a choose-your-own-adventure book. Each paragraph is a page with a title at the top. GOTO is the instruction jump to page CHECK-REGION. GOTO JOB is jump back to the beginning of this chapter and start the next story piece. A PROC is like a side booklet you read completely and then automatically return to where you left off. Paragraphs name the pages; PROCs are mini-books you borrow and return.

Exercises

  1. Write a JOB with CHECK-REGION label and GOTO from an IF on DIV.
  2. Rewrite the same logic using PERFORM and a PROC instead of GOTO.
  3. Explain when GOTO JOB is appropriate versus END-IF fall-through.
  4. List three label naming rules from Broadcom documentation.
  5. Sketch a flowchart for a program with two labeled paragraphs and one GOTO JOB.

Quiz

Test Your Knowledge

1. In Easytrieve, a paragraph entry point is usually marked by:

  • A statement label
  • A JCL //EXEC card
  • A FILE DCB
  • END-PROC only

2. GOTO label transfers control to:

  • The first statement after the label in the same activity or PROC
  • Another JCL step
  • SYSPRINT
  • The linker

3. Paragraphs differ from PROCs because PROCs:

  • Use PERFORM/END-PROC and return automatically
  • Never contain IF statements
  • Replace FILE definitions
  • Run only at compile time

4. GOTO JOB branches to:

  • The top of the current JOB activity
  • A different program
  • The Library section
  • The compile step

5. Structured programming guidance favors:

  • IF/ELSE and PERFORM over excessive GOTO
  • GOTO for every branch
  • No labels ever
  • Only report PROCs
Published
Read time12 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 GOTO, labels, structured programming, and JOB activity flowSources: Broadcom Easytrieve Report Generator 11.6 TechDocs, GOTO statement, JOB Activities, Structured ProgrammingApplies to: Easytrieve labeled logic blocks and branching