Figure 3. CALLSUBR

PGM
DCL        VAR(&ReturnVaL) TYPE(*INT)

CALLSUBR   SUBR(My1stSub)
/* Continue with mainline program */

SUBR       SUBR(My1stSub)
/* Do subroutine stuff */
CALLSUBR   SUBR(My2ndSub) RTNVAL(&ReturnVaL)
ENDSUBR

SUBR       SUBR(My2ndSub)
/* Do subroutine stuff */
ENDSUBR    RTNVAL(1)

ENDPGM