Академический Документы
Профессиональный Документы
Культура Документы
Subroutines
NDVO
R
AS/400 Training
Subroutines
NDVO
R
Subroutines
Subroutine is one of the major constructs RPG IV supports to deal with top down design
and modular development.
A subroutine is a block of code inside a program, with an identifiable beginning and end.
Subroutine is coded between Begsr (Begin subroutine) and Endsr (End subroutine)
operations.
After performing the subroutine, the program returns control to the statement immediately
following the one that invoked the routine.
Each subroutine must have a unique symbolic name.
04/13/15
Showme Consultants
NDVO
R
Subroutines
04/13/15
Showme Consultants
NDVO
R
04/13/15
Showme Consultants
Executing Subroutines
NDVO
R
04/13/15
Showme Consultants
NDVO
R
04/13/15
Showme Consultants
NDVO
R
Syntax:
04/13/15
Showme Consultants
NDVO
R
Examples;
04/13/15
Showme Consultants
NDVO
R
The result field of the CASxx operation must contain the name
of a user subroutine or one of the following the keywords:
*TERMSR, *PSSR or *INZSR;
1. *TERMSR specifies a subroutine to be run during
normal termination.
2. *PSSR specifies that this is a program exception/error
subroutine to handle program-detected exception/errors.
3. *INZSR specifies a subroutine to be run during
initialization.
04/13/15
Showme Consultants
10
NDVO
R
*TERMSR & *PSSR
04/13/15
Showme Consultants
11
NDVO
R
*INZSR (Initialization subroutine)
04/13/15
Showme Consultants
12
Acknowledgements
NDVO
R
04/13/15
Showme Consultants
13
NDVO
R
Showme Consultants
14
NDVO
R
Ndvor IT Solutions.
The following notices applies to the set of training material on
IBM AS/400 training topics
The recipient of this training material can print maximum of
10 copies of the training material or the number authorized by
the copyright holder, whilst distributing it.
Electronic distribution is restricted to the participants of the
classroom training. Who are in turn obligated to respect the
copyright and refrain from distributing it.
Any inquires, permissions in this regard, please use the
Contact us form on the website.
04/13/15
Showme Consultants
15
NDVO
R
04/13/15
Showme Consultants
16