RPGIV @ Work

A unique site for RPG and System i Lovers


Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

New features of RPGIV with IBM i 7.1 Print E-mail
User Rating: / 1
Written by Chamara Withanachchi   
New features of RPGIV with IBM i 7.1

Some of the new features in RPG IV:

Extracted from IBM Site

  1. Sort and search data structure arrays
  2. Support for ALIAS names
  3. Built-in functions
  4. Prototypes are now optional
  5. Performance improvement for returning large values
  6. New options for XML-INTO
  7. Parameter Ordinal Built-in Function
  8. Implicit parameter conversion between alphanumeric, UCS-2 and Graphic
  9. The listing debug view can be encrypted
  10. Support for the teraspace storage model
  11. 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.
        i = %LOOKUP('Jack' : INFO(*).NAME);
  • Support for ALIAS names
    • The ALIAS keyword can be specified on the File specification for an externally described file that will not have Input or Output specifications generated by the compiler. These are files specified with the QUALIFIED keyword, or files specified within subprocedures. When the LIKEREC keyword is used to define a data structure from one of the record formats of the file, the RPG subfield names will be taken from the alternate names of the fields rather than the short names.
    • The ALIAS keyword can be specified on the Definition specification for an externally described data structure. The RPG subfield names will be taken from the alternate names of the fields rather than the short names.
           A          R CUSTREC
           A            CUSTNM        25A         ALIAS(CUSTOMER_NAME)
           A            CUSTAD        25A         ALIAS(CUSTOMER_ADDRESS)
           A            ID            10P 0
           D custDs        e ds                  ALIAS
           D                                     QUALIFIED EXTNAME(custFile)
              custDs.customer_name = 'John Smith';
              custDs.customer_address = '123 Mockingbird Lane';
              custDs.id = 12345;
  • 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)
              // 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)
             data = getFileData ('/home/mydir/myfile.txt');
  • New options for XML-INTO
    • The datasubf option allows you to name a subfield that will receive the text data for an XML element that also has attributes.
    • The countprefix option reduces the need for you to specify the allowmissing=yes option. It specifies the prefix for the names of the additional subfields that receive the number of RPG array elements or non-array subfields set by the XML-INTO operation.

      These options are also available through PTF SI34983 for 6.1.

  • 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
    • RPG modules and programs can be created to use the teraspace storage model or to inherit the storage model of their caller. With the teraspace storage model, the system limits regarding automatic storage are significantly higher than for the single-level storage model. There are limits for the amount of automatic storage for a single procedure and for the total automatic storage of all the procedures on the call stack.
    • Use the storage model (STGMDL) parameter on the CRTRPGMOD or CRTBNDRPG command, or use the STGMDL keyword on the Control specification.
      • *TERASPACE: The program or module uses the teraspace storage model.
      • *SNGLVL: The program or module uses the single-level storage model.
      • *INHERIT: The program or module inherits the storage model of its caller.
    • The default value of the ACTGRP parameter and Control specification keyword is changed from QILE to *STGMDL. ACTGRP(*STGMDL) specifies that the activation group depends on the storage model of the program. When the storage model is *TERASPACE, ACTGRP(*STGMDL) is the same as ACTGRP(QILETS). Otherwise, ACTGRP(*STGMDL) is the same as ACTGRP(QILE).
    • Ability to allocate teraspace storage.

      Use the ALLOC keyword on the Control specification to specify whether the RPG storage-management operations in the module will use teraspace storage or single-level storage. The maximum size of a teraspace storage allocation is significantly larger than the maximum size of a single-level storage allocation.

  • 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

<Previous   Next>