Easytrieve RETURN Statement

CALL reaches out to another load module—COBOL tax routine, Assembler date utility, second Easytrieve program. RETURN is how that callee hands control back. The caller's next statement after CALL runs when RETURN completes, unless STOP or abend ends the task. RETURNS on CALL captures numeric status so IF RC NE 0 branches to error PROC. Beginners confuse RETURN with END-PROC: END-PROC ends an in-program PERFORM module; RETURN ends a separate called program. CICS online adds conversational rules—called programs must not drop the terminal task incorrectly. This page teaches RETURN syntax, pairing with CALL, return code conventions, static versus dynamic binding impact, Easytrieve-as-subprogram patterns, and mistakes that leave callers waiting on modules that STOP instead of RETURN.

Progress0 of 0 lessons

Statement Format

text
1
2
3
4
5
6
7
8
* In called program (callee): RETURN [return-code] * In caller: CALL TAXPGM USING (GROSS, TAX-AMT) RETURNS RC IF RC NE 0 PERFORM CALL-FAILED END-IF

Exact RETURN parameters depend on release—some forms pass explicit numeric return-code; others rely on RETURN-CODE field conventions shared with COBOL linkage. Consult CALL and RETURN chapters together when integrating mixed-language shops.

CALL and RETURN Flow

Invocation lifecycle
StepWhereAction
1Caller JOB/PROGRAMCALL module USING args RETURNS rc
2Callee entryProcess USING parameters
3Callee exitRETURN with status
4CallerTest rc; continue or error branch

Return Codes

Standardize return code meaning per integration guide: zero success, positive application error, negative system error—or shop-specific table. COBOL sets RETURN-CODE special register; Assembler R15; Easytrieve callee sets field expected by RETURNS. Document contract in comment header both teams maintain. Silent ignore of non-zero rc propagates wrong tax, wrong dates, wrong file status into downstream PUT.

RETURN Versus END-PROC Versus STOP

Exit verbs compared
VerbScopeExecution resumes
END-PROCPROC moduleStatement after PERFORM
RETURNCalled programCaller after CALL
STOPEntire Easytrieve runProgram ends
EXITPROC or activity flowPer EXIT rules

Parameter Passing With CALL

USING lists fields or literals passed to callee. Layout must match linkage section on COBOL side—length, order, type. Easytrieve packed versus zoned mismatches corrupt amounts silently. Literals pass fixed tokens such as file name strings. After RETURN, caller fields callee modified by reference still hold updated values if linkage was BY REFERENCE.

Easytrieve as Callee

Shops compile subprograms as separate load modules. Callee ends with RETURN; main driver CALLs them for reusable report slices or validation. Environment PARM CALL sets dynamic versus static binding default. STEPLIB must resolve callee module at runtime for dynamic CALL. Test promote path: fix callee, rerun caller without relink when dynamic.

CICS Conversational Requirement

Broadcom documents that programs called under CICS must execute conversational—the called program must not terminate the CICS task in ways that break pseudo-conversational design. RETURN to caller preserves transaction context; STOP in callee may end task unexpectedly. Coordinate with CICS systems programming on EXEC CICS RETURN equivalents in COBOL subprograms called from Easytrieve online.

Binding and LINK Considerations

Static binding resolves callee at link-edit; dynamic at runtime from STEPLIB. Wrong binding choice causes old callee level or module not found. RETURN does not fix linkage errors—verify binder deck includes callee when static. Returns field must be numeric working storage wide enough for return codes your callee sets.

Common RETURN Mistakes

  • Callee STOP instead of RETURN—caller never continues correctly.
  • Ignoring RETURNS after CALL.
  • Confusing RETURN with END-PROC in same source module.
  • Parameter layout mismatch with COBOL linkage.
  • Non-conversational callee on CICS online.
  • Missing STEPLIB for dynamic CALL target.

Explain It Like I'm Five

CALL is asking a friend to solve one math problem for you. RETURN is the friend handing back the answer and saying done—you continue your homework. END-PROC is finishing one worksheet section inside your own notebook, not visiting a friend. STOP is closing the whole notebook and going home.

Exercises

  1. Write CALL with RETURNS and IF branch on non-zero.
  2. Document return code table for a hypothetical TAXPGM.
  3. Contrast RETURN, END-PROC, STOP, EXIT in four sentences each.
  4. List linkage checks before first COBOL CALL integration test.
  5. Explain CICS conversational rule in shop terms.

Quiz

Test Your Knowledge

1. RETURN typically ends:

  • Current called program flow back to caller
  • Only REPORT block
  • FILE definition
  • JCL step

2. CALL pairs with RETURN in:

  • Called Easytrieve or subprogram modules
  • TITLE statements
  • FILE FB
  • MACRO only

3. RETURNS on CALL clause:

  • Names field receiving numeric return code
  • Defines sort key
  • Opens printer
  • Skips LINK

4. RETURN differs from END-PROC because:

  • END-PROC returns from PERFORM PROC; RETURN exits CALL target
  • They are identical
  • RETURN only sorts
  • END-PROC only prints

5. CICS called programs must:

  • Stay conversational per Broadcom CALL rules
  • Always STOP
  • Never use RETURN
  • Ignore LINK
Published
Read time15 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 RETURN and CALLSources: Broadcom Easytrieve 11.6 Language Reference RETURN, CALLApplies to: Easytrieve RETURN with CALL subprograms