|
New features of RPGIV with IBM i 7.1 |
|
|
|
Written by Admin (Chamara)
|
|
Apr 16, 2010 at 01:02 AM |
|
New features of RPGIV with IBM i 7.1
Some of the new features in RPG IV:
Extracted from IBM Site
- Sort and search data structure arrays
- Support for ALIAS names
- Built-in functions
- Prototypes are now optional
- Performance improvement for returning large values
- New options for XML-INTO
- Parameter Ordinal Built-in Function
- Implicit parameter conversion between alphanumeric, UCS-2 and Graphic
- The listing debug view can be encrypted
- Support for the teraspace storage model
- Support for Open Access: RPG Edition
ILE RPG V7.1 enhancements
- Sort and search data structure arrays: To sort or search a data
structure array, one subfield is identified as the "key" for the array, using
the syntax ARRAY(*).KEYSUBFIELD. The following examples sort the INFO array
by the SALARY subfield and search for the name 'Jack' in the NAME subfield
of the INFO array.
SORTA INFO(*).SALARY;
i = %LOOKUP('Jack' : INFO(*).NAME);
- Support for ALIAS names
- New and updated built-in functions
- The %SCANRPL built-in function scans for all occurrences of a value within
a string and replaces them with another value.
// Replace NAME with 'Tom'
string1 = 'See NAME. See NAME run. Run NAME run.';
string2 = %ScanRpl('NAME' : 'Tom' : string1);
// string2 = 'See Tom. See Tom run. Run Tom run.'
- New built-in function %PARMNUM can be used within a procedure to soft-code
the number of a parameter.
D pi
D name 100a const varying
D id 10i 0 value
D errorInfo likeds(errs_t)
D options(*nopass)
/free
// Check if the "errorInfo" parameter was passed
if %parms >= %parmnum(errorInfo);
- Enhanced built-in function %LEN can now be used to obtain the maximum
number of characters in a varying-length alphanumeric, UCS-2 or DBCS variable.
- Optional prototypes: If a program or procedure is not called by
another RPG module, it is optional to specify the prototype. The prototype
may be omitted for the following types of programs and procedures:
- A program that is only intended to be used as an exit program or as the
command-processing program for a command
- A program that is only intended to be called from a different programming
language
- A procedure that is not exported from the module
- A procedure that is exported from the module but only intended to be
called from a different programming language
- Performance improvement for returning large values: A procedure
defined with the RTNPARM keyword handles the return value as a hidden parameter.
When a procedure is prototyped to return a very large value, especially a
very large varying value, the performance for calling the procedure can be
significantly improved by defining the procedure with the RTNPARM keyword.
D getFileData pr a varying len(1000000)
D rtnparm
D file a const varying len(500)
D data S a varying len(1000)
/free
data = getFileData ('/home/mydir/myfile.txt');
- New options for XML-INTO
- Pass any type of string parameter: Implicit conversion will be
done for string parameters passed by value or by read-only reference. For
example, a procedure can be prototyped to have a CONST UCS-2 parameter, and
character expression can be passed as a parameter on a call to the procedure.
This enables you to write a single procedure with the parameters and return
value prototyped with the UCS-2 type. To call that procedure, you can pass
any type of string parameter, and assign the return value to any type of string
variable.
// The makeTitle procedure upper-cases the value
// and centers it within the provided length
alphaTitle = makeTitle(alphaValue : 50);
ucs2Title = makeTitle(ucs2Value : 50);
dbcsTitle = makeTitle(dbcsValue : 50);
- Support for encryption of debug data: A new debug encryption key
compiler option, DBGENCKEY, is supported in the ILE RPG compiler. This option
specifies the key to be used to encrypt source code that is embedded in debug
views of a module (for example, the Listing View debug view created by specifying
the DBGVIEW(*LIST) compile option). An equivalent option is available on the
start debug command, STRDBG, to specify the key for decryption of the encrypted
debug views.
- Support for the teraspace storage model
- Support for Open Access: RPG Edition
Open Access is a full-featured
version of the limited support provided by RPG SPECIAL files. It provides
a way for RPG programmers to use the simple and well-understood RPG I/O model
to access devices that are not directly supported by RPG.
When the
HANDLER keyword is specified on a File specification, the RPG compiler will
generate code to use the specified handling procedure for I/O operations to
the file rather than generating code to call the system's data management
functions.
The HANDLER keyword can be used for any RPG device, DISK,
PRINTER, or WORKSTN. The provider of the handling procedure can choose the
RPG device-type that best fits the function that the handler provides. For
example, a user-interface application could map to a WORKSTN file, an Excel
document could map to a PRINTER file, and a Web service could map to a keyed
DISK file.
To obtain the runtime enablement for these capabilities,
customers should order IBM Rational Open Access: RPG Edition (5733-OAR).
For more details Click Here
or Click Here
|
|
Last Updated ( Apr 21, 2010 at 03:01 AM )
|