ILERPG.com β€” IBM i Β· ILE RPG Β· AS400 Mastery

This lesson is locked

A short preview is available. Purchase once for lifetime access.

Beginner Β· 12:11

Procedures and Subprocedures: Definition and Scope

A subroutine has no parameters, no return value, and no local storage, so everything it touches is global. A subprocedure states its contract at the call site. This lesson covers defining subprocedures with DCL-PROC and DCL-PI, the structure of a module, cycle-main, linear-main (MAIN), and…

What you'll be able to do

  1. 1Define a subprocedure with DCL-PROC and END-PROC, including a procedure interface and return value, and call it as an expression and as a statement.
  2. 2Describe the structure of a multiple-procedure module, and distinguish cycle-main, linear-main (MAIN), and NOMAIN modules.
  3. 3Determine the scope of any definition in a module, and predict the effect of a local definition with the same name as a global one.
  4. 4Explain automatic versus static storage for local definitions, and use STATIC deliberately.
  5. 5State the scope rules for indicators, subroutines, *INLR, local files, and procedure names, and apply them when refactoring subroutines into subprocedures.

Create your account

Takes a few seconds β€” you'll be right back here after.

Sign in

Welcome back β€” you'll be right back here after.

Forgot your password?