Previous Topic: DEFINENext Topic: Utility Commands


GOBACK

Purpose

Terminates subroutine processing.

Syntax

►►─── GOBACK ──── .  ─────────────────────────────────────────────────────────►◄

Usage

At run time, GOBACK returns processing control to the command following the CALL that passed control to the subroutine.

Considerations

Example

The following example uses the CALL, DEFINE, and GOBACK commands to illustrate the use of a subroutine within a process:

FIND CALC CUSTOMER.
IF DB-REC-NOT-FOUND
THEN
  DO.
    STORE CUSTOMER.
    CALL UPDMAIL.
    DISPLAY MSG TEXT 'CUSTOMER ADDED'.
  END.
ELSE
  DO.
    MODIFY CUSTOMER.
    CALL UPDMAIL.
    DISPLAY MESSAGE TEXT 'CUSTOMER CHANGED'.
  END.
DEFINE SUBROUTINE UPDMAIL.
 MOVE 1 TO SB.
 WHILE SB LE 3
   REPEAT.
     MOVE CUST-INT(SB) TO MAIL-INT.
     FIND CALC MAILIST.
     CONNECT CUSTOMER TO MAILIST.
     ADD 1 TO SB.
   END.
GOBACK.