An RPG/400 subroutine is a group of calculation specification statements in a program that can be processed several times in that program. The RPG/400 subroutine operations are:
RPG/400 subroutine specifications must follow all other calculation operations that can be processed for a program; however, the PLIST, PARM, KLIST, KFLD, and DEFN operations may be specified between an ENDSR operation (the end of one subroutine) and a BEGSR operation (the beginning of another subroutine) or after all subroutines. A subroutine can be called from any point in the calculation operations. Subroutine lines can be identified by SR in positions 7 and 8. The only valid entries in positions 7 and 8 of a subroutine line are SR, AN, OR, or blanks.
For information on how to code a subroutine, see Coding Subroutines.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.