What's New in V4R4?

The major enhancements to RPG IV since V4R2 are the support for running ILE RPG modules safely in a threaded environment, the new 3-digit and 20-digit signed and unsigned integer data types, and support for a new Universal Character Set Version 2 (UCS-2) data type and for conversion between UCS-2 fields and graphic or single-byte character fields.

The following list describes these enhancements:

  • Support for calling ILE RPG procedures from a threaded application, such as Domino® or Java™.
    • The new control specification keyword THREAD(*SERIALIZE) identifies modules that are enabled to run in a multithreaded environment. Access to procedures in the module is serialized.
  • Support for new 1-byte and 8-byte integer data types: 3I and 20I signed integer, and 3U and 20U unsigned integer
    • These new integer data types provide you with a greater range of integer values and can also improve performance of integer computations, taking full advantage of the 64-bit AS/400 RISC processor.
    • The new 3U type allows you to more easily communicate with ILE C procedures that have single-byte character (char) return types and parameters passed by value.
    • The new INTPREC control specification keyword allows you to specify 20-digit precision for intermediate values of integer and unsigned binary arithmetic operations in expressions.
    • Built-in functions %DIV and %REM have been added to support integer division and remainder operations.
  • Support for new Universal Character Set Version 2 (UCS-2) or Unicode data type
    • The UCS-2 (Unicode) character set can encode the characters for many written languages. The field is a character field whose characters are two bytes long.
    • By adding support for Unicode, a single application can now be developed for a multinational corporation, minimizing the necessity to perform code page conversion. The use of Unicode permits the processing of characters in multiple scripts without loss of integrity.
    • Support for conversions between UCS-2 fields and graphic or single-byte character fields using the MOVE and MOVEL operations, and the new %UCS2 and %GRAPH built-in functions.
    • Support for conversions between UCS-2 fields or graphic fields with different Coded Character Set Identifiers (CCSIDs) using the EVAL, MOVE, and MOVEL operations, and the new %UCS2 built-in function.

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

  • New parameters for the OPTION control specification keyword and on the create commands:
    • *SRCSTMT allows you to assign statement numbers for debugging from the source IDs and SEU sequence numbers in the compiler listing. (The statement number is used to identify errors in the compiler listing by the debugger, and to identify the statement where a run-time error occurs.) *NOSRCSTMT specifies that statement numbers are associated with the Line Numbers of the listing and the numbers are assigned sequentially.
    • Now you can choose not to generate breakpoints for input and output specifications in the debug view with *NODEBUGIO. If this option is selected, a STEP on a READ statement in the debugger will step to the next calculation, rather than stepping through the input specifications.
  • New special words for the INZ definition specification keyword:
    • INZ(*EXTDFT) allows you to use the default values in the DDS for initializing externally described data structure subfields.
    • Character variables initialized by INZ(*USER) are initialized to the name of the current user profile.
  • The new %XFOOT built-in function sums all elements of a specified array expression.
  • The new EVALR operation code evaluates expressions and assigns the result to a fixed-length character or graphic result. The assignment right-adjusts the data within the result.
  • The new FOR operation code performs an iterative loop and allows free-form expressions for the initial, increment, and limit values.
  • The new LEAVESR operation code can be used to exit from any point within a subroutine.
  • The new *NEXT parameter on the OVERLAY(name:*NEXT) keyword indicates that a subfield overlays another subfield at the next available position.
  • The new *START and *END values for the SETLL operation code position to the beginning or end of the file.
  • The ability to use hexadecimal literals with integer and unsigned integer fields in initialization and free-form operations, such as EVAL, IF, etc.
  • New control specification keyword OPENOPT{(*NOINZOFL | *INZOFL)} to indicate whether the overflow indicators should be reset to *OFF when a file is opened.
  • Ability to tolerate pointers in teraspace — a memory model that allows more than 16 megabytes of contiguous storage in one allocation.

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

Table 1. Changed Language Elements Since V4R2
Language Unit Element Description
Control specification keywords OPTION(*{NO}SRCSTMT) *SRCSTMT allows you to request that the compiler use SEU sequence numbers and source IDs when generating statement numbers for debugging. Otherwise, statement numbers are associated with the Line Numbers of the listing and the numbers are assigned sequentially.
OPTION(*{NO}DEBUGIO) *{NO}DEBUGIO, determines if breakpoints are generated for input and output specifications.
Definition specification keywords INZ(*EXTDFT) All externally described data structure subfields can now be initialized to the default values specified in the DDS.
INZ(*USER) Any character field or subfield can be initialized to the name of the current user profile.
OVERLAY(name:*NEXT) The special value *NEXT indicates that the subfield is to be positioned at the next available position within the overlayed field.
OPTIONS(*NOPASS *OMIT *VARSIZE *STRING *RIGHTADJ) The new OPTIONS(*RIGHTADJ) specified on a value or constant parameter in a function prototype indicates that the character, graphic, or UCS-2 value passed as a parameter is to be right adjusted before being passed on the procedure call.
Definition specification positions 33-39 (To Position/Length) 3 and 20 digits allowed for I and U data types Added to the list of allowed values for internal data types to support 1-byte and 8-byte integer and unsigned data.
Internal data type C (UCS-2 fixed or variable-length format) Added to the list of allowed internal data types on the definition specifications. The UCS-2 (Unicode) character set can encode the characters for many written languages. The field is a character field whose characters are two bytes long.
Data format C (UCS-2 fixed or variable-length format) UCS-2 format added to the list of allowed data formats on the input and output specifications for program described files.
Command parameter OPTION *NOSRCSTMT, *SRCSTMT, *NODEBUGIO, and *DEBUGIO have been added to the OPTION parameter on the CRTBNDRPG and CRTRPGMOD commands.
Table 2. New Language Elements Since V4R2
Language Unit Element Description
Control specification keywords CCSID(*GRAPH: *IGNORE | *SRC | number) Sets the default graphic CCSID for the module. This setting is used for literals, compile-time data and program-described input and output fields and definitions. The default is *IGNORE.
CCSID(*UCS2: number) Sets the default UCS-2 CCSID for the module. This setting is used for literals, compile-time data and program-described input and output fields and definitions. The default is 13488.
INTPREC(10 | 20) Specifies the decimal precision of integer and unsigned intermediate values in binary arithmetic operations in expressions. The default, INTPREC(10), indicates that 10-digit precision is to be used.
OPENOPT{(*NOINZOFL | *INZOFL)} Indicates whether the overflow indicators should be reset to *OFF when a file is opened.
THREAD(*SERIALIZE) Indicates that the module is enabled to run in a multithreaded environment. Access to the procedures in the module is to be serialized.
Definition specification keywords CCSID(number | *DFT) Sets the graphic and UCS-2 CCSID for the definition.
Built-in functions %DIV(n:m) Performs integer division on the two operands n and m; the result is the integer portion of n/m. The operands must be numeric values with zero decimal positions.
%GRAPH(char-expr | graph-expr | UCS2-expr {: ccsid}) Converts to graphic data from single-byte character, graphic, or UCS-2 data.
%REM(n:m) Performs the integer remainder operation on two operands n and m; the result is the remainder of n/m. The operands must be numeric values with zero decimal positions.
%UCS2(char-expr | graph-expr | UCS2-expr {: ccsid}) Converts to UCS-2 data from single-byte character, graphic, or UCS-2 data.
%XFOOT(array-expr) Produces the sum of all the elements in the specified numeric array expression.
Operation codes EVALR Evaluates an assignment statement of the form result=expression. The result will be right-justified.
FOR Begins a group of operations and indicates the number of times the group is to be processed. The initial, increment, and limit values can be free-form expressions.
ENDFOR ENDFOR ends a group of operations started by a FOR operation.
LEAVESR Used to exit from anywhere within a subroutine.