What's New in V3R6/V3R2?

The major enhancement to RPG IV since V3R1 is the ability to code a module with more than one procedure. What does this mean? In a nutshell, it means that you can code an module with one or more prototyped procedures, where the procedures can have return values and run without the use of the RPG cycle.

Writing a module with multiple procedures enhances the kind of applications you can create. Any application consists of a series of logical units that are conceived to accomplish a particular task. In order to develop applications with the greatest flexibility, it is important that each logical unit be as independent as possible. Independent units are:

The main benefit of coding a module with multiple procedures is greater control and better efficiency in coding a modular application. This benefit is realized in several ways. You can now:

The run-time behavior of the main procedure in a module is the same as that of a V3R1 procedure. The run-time behavior of any subsequent procedures differs somewhat from a V3R1 program, most notably in the areas of procedure end and exception handling. These differences arise because there is no cycle code that is generated for these procedures.

Other enhancements have been made to for this release as well. These include:

The following tables summarize the changed and new language elements, based on the part of the language affected.

Table 19. Changed Language Elements Since V3R1
Language Unit Element Description
File description specification keywords PREFIX(prefix_string {:nbr_of_char_ replaced}) Allows prefixing of string to a field name or a partial rename of the field name
Definition specification keywords CONST{(constant)} Specifies the value of a named constant, or indicates that a prototyped parameter that is passed by reference has a constant value
PREFIX(prefix_string {:nbr_of_char_ replaced}) Allows prefixing of string to a field name or a partial rename of the field name
Operation codes RETURN Returns control to the caller, and returns a value, if specified
Table 20. New Language Elements Since V3R1
Language Unit New Description
Control specification keywords COPYRIGHT('copyright string') Allows you to associate copyright information with modules and programs
EXTBININT{(*NO | *YES)} Specifies that binary fields in externally-described files be assigned an integer format during program processing
NOMAIN Indicates that the module has only subprocedures
File description specification keywords BLOCK(*YES |*NO) Allows you to control whether record blocking occurs (assuming other conditions are met)
Definition specification keywords ALIGN Specifies whether integer or unsigned fields should be aligned
EXTPGM(name) Indicates the external name of the prototyped program
EXTPROC(name) Indicates the external name of the prototyped procedure
OPDESC Indicates whether operational descriptors are to be passed for the prototyped bound call
OPTIONS(*NOPASS *OMIT *VARSIZE) Specifies various options for prototyped parameters
STATIC Specifies that the local variable is to use static storage
VALUE Specifies that the prototyped parameter is to be passed by value
Built-in functions %PARMS Returns the number of parameters passed on a call
Operation codes CALLP Calls a prototyped program or procedure
Specification type Procedure specification Signals the beginning and end of a subprocedure definition
Definition type PR Signals the beginning of a prototype definition
PI Signals the beginning of a procedure interface definition
blank in positions 24-25 Defines a prototyped parameter


[ Top of Page | Previous Page | Next Page | Contents | Index ]