What's New in V6R1

This section describes the enhancements made to ILE RPG in V6R1.

THREAD(*CONCURRENT)

When THREAD(*CONCURRENT) is specified on the Control specification of a module, it provides ability to run concurrently in multiple threads:

Ability to define a main procedure which does not use the RPG cycle

Using the MAIN keyword on the Control specification, a subprocedure can be identified as the program entry procedure. This allows an RPG application to be developed where none of the modules uses the RPG cycle.

Files defined in subprocedures

Files can be defined locally in subprocedures. I/O to local files can only be done with data structures; I and O specifications are not allowed in subprocedures, and the compiler does not generate I and O specifications for externally described files. By default, the storage associated with local files is automatic; the file is closed when the subprocedure returns. The STATIC keyword can be used to indicate that the storage associated with the file is static, so that all invocations of the subprocedure will use the same file, and if the file is open when the subprocedure returns, it will remain open for the next call to the subprocedure.

Qualified record formats

When a file is defined with the QUALIFIED keyword, the record formats must be qualified by the file name, MYFILE.MYFMT. Qualified files do not have I and O specifications generated by the compiler; I/O can only be done through data structures.

Files defined like other files

Using the LIKEFILE keyword, a file can be defined to use the same settings as another File specification, which is important when passing a file as a parameter. If the file is externally-described, the QUALIFIED keyword is implied. I/O to the new file can only be done through data structures.

Files passed as parameters

A prototyped parameter can be defined as a File parameter using the LIKEFILE keyword. Any file related through the same LIKEFILE definition may be passed as a parameter to the procedure. Within the called procedure or program, all supported operations can be done on the file; I/O can only be done through data structures.

EXTDESC keyword and EXTFILE(*EXTDESC)

The EXTDESC keyword identifies the file to be used by the compiler at compile time to obtain the external decription of the file; the filename is specified as a literal in one of the forms 'LIBNAME/FILENAME' or 'FILENAME'. This removes the need to provide a compile-time override for the file.

The EXTFILE keyword is enhanced to allow the special value *EXTDESC, indicating that the file specified by EXTDESC is also to be used at runtime.

EXTNAME to specify the library for the externally-described data structure

The EXTNAME keyword is enhanced to allow a literal to specify the library for the external file. EXTNAME('LIBNAME/FILENAME') or EXTNAME('FILENAME') are supported. This removes the need to provide a compile-time override for the file.

EXFMT allows a result data structure

The EXFMT operation is enhanced to allow a data structure to be specified in the result field. The data structure must be defined with usage type *ALL, either as an externally-described data structure for the record format (EXTNAME(file:fmt:*ALL), or using LIKEREC of the record format (LIKEREC(fmt:*ALL).

Larger limits for data structures, and character, UCS-2 and graphic variables

%ADDR(varying : *DATA)

The %ADDR built-in function is enhanced to allow *DATA as the second parameter to obtain the address of the data part of a variable length field.

Larger limit for DIM and OCCURS

An array or multiple-occurrence data structure can have up to 16,773,104 elements, provided that the total size is not greater than 16,773,104.

Larger limits for character, UCS-2 and DBCS literals

TEMPLATE keyword for files and definitions

The TEMPLATE keyword can be coded for file and variable definitions to indicate that the name will only be used with the LIKEFILE, LIKE, or LIKEDS keyword to define other files or variables. Template definitions are useful when defining types for prototyped calls, since the compiler only uses them at compile time to help define other files and variables, and does not generate any code related to them.

Template data structures can have the INZ keyword coded for the data structure and its subfields, which will ease the use of INZ(*LIKEDS).

Relaxation of some UCS-2 rules

The compiler will perform some implicit conversion between character, UCS-2 and graphic values, making it unnecessary to code %CHAR, %UCS2 or %GRAPH in many cases. This enhancement is also available through PTFs for V5R3 and V5R4. Implicit conversion is now supported for

UCS-2 variables can now be initialized with character or graphic literals without using the %UCS2 built-in function.

Eliminate unused variables from the compiled object

New values *UNREF and *NOUNREF are added to the OPTION keyword for the CRTBNDRPG and CRTRPGMOD commands, and for the OPTION keyword on the Control specification. The default is *UNREF. *NOUNREF indicates that unreferenced variables should not be generated into the RPG module. This can reduce program size, and if imported variables are not referenced, it can reduce the time taken to bind a module to a program or service program.

PCML can now be stored in the module

Program Call Markup Language (PCML) can now be stored in the module as well as in a stream file. By using combinations of the PGMINFO command parameter and/or the new PGMINFO keyword for the Control specification, the RPG programmer can choose where the PCML information should go. If the PCML information is placed in the module, it can later be retrieved using the QBNRPII API. This enhancement is also available through PTFs for V5R4, but only through the Control specification keyword.

Table 3. Changed Language Elements Since V5R4
Language Unit Element Description
Control specification keywords OPTION(*UNREF | *NOUNREF) Specifies that unused variables should not be generated into the module.
THREAD(*CONCURRENT) New parameter *CONCURRENT allows running concurrently in multiple threads.
File specification keywords EXTFILE(*EXTDESC) Specifies that the value of the EXTDESC keyword is also to be used for the EXTFILE keyword.
Built-in functions %ADDR(varying-field : *DATA) Can now be used to obtain the address of the data portion of a varying-length variable.
Definition specification keywords DIM(16773104) An array can have up to 16773104 elements.
EXTNAME('LIB/FILE') Allows a literal for the file name. The literal can include the library for the file.
OCCURS(16773104) A multiple-occurrence data structure can have up to 16773104 elements.
VARYING{(2|4)} Can now take a parameter indicating the number of bytes for the length prefix.
Definition specifications Length entry Can be up to 9999999 for Data Structures, and definitions of type A, C or G. (To define a longer item, the LEN keyword must be used.)
Input specifications Length entry Can be up to 99999 for alphanumeric fields, and up to 99998 for UCS-2 and Graphic fields.
Calculation specifications Length entry Can be up to 99999 for alphanumeric fields.
Operation codes EXFMT format { result-ds } Can have a data structure in the result entry.
Table 4. New Language Elements Since V5R4
Language Unit Element Description
Control specification keywords MAIN(subprocedure-name) Specifies the program-entry procedure for the program.
PGMINFO(*NO | *PCML { : *MODULE } ) Indicates whether Program Information is to be placed directly in the module.
File specification keywords STATIC Indicates that a local file retains its program state across calls to a subprocedure.
QUALIFIED Indicates that the record format names of the file are qualified by the file name, FILE.FMT.
LIKEFILE(filename) Indicates that the file is defined the same as another file.
TEMPLATE Indicates that the file is only to be used for later LIKEFILE definitions.
EXTDESC(constant-filename) Specifies the external file used at compile time for the external definitions.
Definition specification keywords STATIC(*ALLTHREAD) Indicates that the same instance of the static variable is used by all threads running in the module.
LIKEFILE(filename) Indicates that the parameter is a file.
TEMPLATE Indicates that the definition is only to be used for LIKE or LIKEDS definitions.
LEN(length) Specifies the length of a data structure, or a definition of type A, C or G.
Procedure specification keywords SERIALIZE Indicates that the procedure can be run by only one thread at a time.


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