What's New in V5R1?

The ILE RPG compiler is part of the IBM IBM Rational Development Studio for System i product, which now includes the C/C++ and COBOL compilers, and the Application Development ToolSet tools.

The major enhancements to RPG IV since V4R4 are easier interfacing with Java, new built-in functions, free form calculation specifications, control of which file is opened, qualified subfield names, and enhanced error handling.

The following list describes these enhancements:

Other enhancements have been made to 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 11. Changed Language Elements Since V4R4
Language Unit Element Description
Built-in functions %CHAR(expression{:format}) The optional second parameter specifies the desired format for a date, time, or timestamp. The result uses the format and separators of the specified format, not the format and separators of the input.
%PADDR(prototype-name) This function can now take either a prototype name or an entry point name as its argument.
Definition specification keywords EXTPROC(*JAVA:class-name:proc-name) Specifies that a Java method is called.
EXTPROC(*CL:proc-name) Specifies a procedure that uses ILE CL conventions for return values.
EXTPROC(*CWIDEN:proc-name) Specifies a procedure that uses ILE C conventions with parameter widening.
EXTPROC(*CNOWIDEN:proc-name) Specifies a procedure that uses ILE C conventions without parameter widening.
INZ(*LIKEDS) Specifies that a data structure defined with the LIKEDS keyword inherits the initialization from its parent data structure.
LIKE(object-name) Specifies that an object has the same class as another object.
PREFIX(character-literal{:number}) Prefixes the subfields with the specified character literal, optionally replacing the specified number of characters.
File specification keywords OFLIND(name) This keyword can now take any named indicator as a parameter.
PREFIX(character-literal{:number}) Prefixes the subfields with the specified character literal, optionally replacing the specified number of characters.
Operation codes DUMP (A) This operation code can now take the A extender, which causes a dump to be produced even if DEBUG(*NO) was specified.
Table 12. New Language Elements Since V4R4
Language Unit Element Description
Data types Object Used for Java objects
Compiler directives /FREE ... /END-FREE The /FREE... /END-FREE compiler directives denote a free-form calculation specifications block.
/INCLUDE Equivalent to /COPY, except that it is not expanded by the SQL preprocessor. Can be used to inlcude nested files that are within the copied file. The copied file cannot have embedded SQlL or host variables.
Definition specification keywords CLASS(*JAVA:class-name) Specifies the class for an object.
LIKEDS(dsname) Specifies that a data structure, prototyped parameter, or return value inherits the subfields of another data strucutre.
QUALIFIED Specifies that the subfield names in a data structure are qualified with the data structure name.
File specification keywords EXTFILE(filename) Specifies which file is opened. The value can be a literal or a variable. The default file name is the name specified in position 7 of the file specification. The default library is *LIBL.
EXTMBR(membername) Specifies which member is opened. The value can be a literal or a variable. The default is *FIRST.
Built-in functions %ALLOC(num) Allocates the specified amount of storage.
%CHECK(comparator:base{:start}) Finds the first character in the base string that is not in the comparator.
%CHECKR(comparator:base{:start}) Finds the last character in the base string that is not in the comparator.
%DATE(expression{:date-format}) Converts the expression to a date.
%DAYS(num) Converts the number to a duration, in days.
%DIFF(op1:op2:unit) Calculates the difference (duration) between two date, time, or timestamp values in the specified units.
%HOURS(num) Converts the number to a duration, in hours.
%LOOKUPxx(arg:array{:startindex {:numelems}}) Finds the specified argument, or the specified type of near-match, in the specified array.
%MINUTES(num) Converts the number to a duration, in minutes.
%MONTHS(num) Converts the number to a duration, in months.
%MSECONDS(num) Converts the number to a duration, in microseconds.
%OCCUR(dsn-name) Sets or gets the current position of a multiple-occurrence data structure.
%REALLOC(pointer:number) Reallocates the specified amount of storage for the specified pointer.
%SECONDS(num) Converts the number to a duration, in seconds.
%SHTDN Checks if the system operator has requested shutdown.
%SQRT(numeric-expression) Calculates the square root of the specified number.
%SUBDT(value:unit) Extracts the specified portion of a date, time, or timestamp value.
%THIS Returns an Object value that contains a reference to the class instance on whose behalf the native method is being called.
%TIME(expression{:time-format}) Converts the expression to a time.
%TIMESTAMP(expression {:*ISO|*ISO0}) Converts the expression to a timestamp.
%TLOOKUP(arg:search-table {:alt-table}) Finds the specified argument, or the specified type of near-match, in the specified table.
%XLATE(from:to:string{:startpos}) Translates the specified string, based on the from-string and to-string.
%YEARS(num) Converts the number to a duration, in years.
Operation codes MONITOR Begins a group of operations with conditional error handling.
ON-ERROR Performs conditional error handling, based on the status code.
ENDMON Ends a group of operations with conditional error handling.
ELSEIF Equivalent to an ELSE operation code followed by an IF operation code.
CRTBNDRPG and CRTRPGMOD keywords LICOPT(options) Specifies Licensed Internal Code options.


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