This course covers how to code and call subprograms and procedures in RPG.
The course first describes the concepts related to subprograms and procedures. You will be introduced to the two types of procedures and subprograms (prototyped and non-prototyped) and see how programs and procedures share data. Next, the course describes how to code and to call a prototyped procedure or subprogram. Subprocedures and user-defined functions are covered next.
The course then shows how to code and to call non-prototyped procedures and subprograms. This discussion includes how to define a parameter list to pass and accept parameters.
You will then see the coding requirements for a linear-main module. A linear-main module is one that includes a main procedure but does not include the code for the program cycle. Finally, the course covers advanced topics related to procedures and subprograms. You will see how to accept parameters in a main program, how to code a procedure that accepts a variable number of parameters, and how to export and import data items.
Approximate Study Time: 2 hours
After completing this course, you should be able to:
- Identify the advantages of modularizing an application
- Identify and describe the methods that can be used to modularize an application
- Describe the techniques that can be used to allow a calling program or procedure to communicate with a subprogram or called procedure
- Describe the differences between a prototyped and non-prototyped call
- Code a prototype definition
- Code a prototyped procedure or subprogram
- Call a prototyped procedure or subprogram
- Code a subprocedure
- Code a user-defined function
- Invoke a user-defined function
- Identify the op codes used to:
- Call a non-prototyped subprogram
- Call a non-prototyped procedure
- Define a parameter list for a non-prototyped call
- Identify and describe the three types of RPG modules
- Identify and describe the coding requirements for a linear-main module
- Code a main program that accepts parameters
- Code a procedure that accepts a variable number of parameters
- Define a local variable that is stored in static storage
- Export and import data items
Using Subprograms and Procedures
Prototyped Procedures and Subprograms
Coding a Subprocedure
Non-Prototyped Subprograms and Procedures
Coding a Linear-Main Module
This course is intended for IBM i programmers new to the RPG programming language. It can also be taken by RPG III programmers who want to learn RPG IV.
This course assumes that you are familiar with computer programming concepts. In order to satisfy this prerequisite, you should have some programming experience with another programming language.
This course also assumes that you have a working knowledge of basic IBM i concepts and facilities. You can satisfy this prerequisite by successfully completing the courses in the following series:
In addition, the course also assumes you familiar with IBM i programming concepts and facilities. You can satisfy this prerequisite by successfully completing the courses in the following series:
Finally, the course assumes that you have a basic understanding of RPG programming concepts. You can satisfy this prerequisite by successfully completing the previous courses in this series: