IBM Support

RPG Cafe: Fall 2020: Numeric BIF enhancements



RPG enhancement for string parameters to numeric BIFs such as %DEC, %INT, and %FLOAT. New values for EXPROPTS to allow blanks, and allow thousands separators.


You are in: RPG Cafe > Fall 2020: Numeric BIF enhancements

Short URL:

RPG Cafe: %DEC(blank), %DEC('-1,234.56')


After you compile your program to use this enhancement, a runtime PTF is needed on any system where you run your program.

  • On a 7.3 system, you need PTF SI74559.
  • On a 7.4 system, you need PTF SI74560.

See PTFs below.

New rules for string parameters for %DEC, %INT, etc.

  • Use EXPROPTS(*ALWBLANKNUM) to allow an all-blank value.
  • Use EXPROPTS(*USEDECEDIT) to allow digit separators, such as thousands separators.
  • These keywords also affect the way XML-INTO and DATA-INTO handle the values for numeric fields and subfields.



With EXPROPTS(*ALWBLANKNUM), the character parameter for numeric built-in functions such as %DEC and %FLOAT return zero if the parameter is blank or empty. (Without EXPROPTS(*ALWBLANKNUM), these built-in functions fail with status code 105 if the character parameter is blank or empty.)

In this example, EXPROPTS(*ALWBLANKNUM) is specified. The parameter for %DEC is blank, and %DEC returns zero.

          DCL-S num PACKED(5 : 2);
          DCL-S string CHAR(20);

          string = *BLANKS;
          num = %DEC(string : 63 : 5);
          // num = 0


With EXPROPTS(*USEDECEDIT), the character parameter for numeric built-in functions such as %DEC and %FLOAT can have digit separators. The DECEDIT keyword is used to determine the decimal point and digit separator character. (Without EXPROPTS(*USEDECEDIT), both the period and comma are considered to be the decimal point, and a string with digit separators such as '1,234,567.8' fails with status code 105 because it has three decimal points.)

In this example, EXPROPTS(*USEDECEDIT) is specified. The parameter for the DECEDIT keyword defaults to '.', so the period is the decimal point and the comma is the digit separator. The parameter for %DEC has thousands separators and a decimal point, and %DEC returns -1234567.89.

          DCL-S num PACKED(15 : 5);
          DCL-S string CHAR(20);

          string = '-1,234,567.89';
          num = %DEC(string : 63 : 5);
          // num = -1234567.89
.                                                            .
.                                                            .

PTFs for 7.3 and 7.4, available in November 2020


Warning: You need a runtime PTF on every system where the program runs. If the runtime PTF is not applied on the system where the program is running, a string with only blanks or with digit separators causes an exception.

  • ILE RPG compiler: SI74612
  • ILE RPG runtime: SI74559


  • ILE RPG compiler: SI74613
  • ILE RPG compiler, TGTRLS(V7R3M0): SI74614
  • ILE RPG runtime: SI74560

The PTFs will also be available with the Db2 for i Fix Packs. See Db2 for IBM i 2020 PTF Group Schedule.

RDi support

The next release of RDi will support this enhancement.

Documentation in the IBM Knowledge Center

The ILE RPG Reference and ILE RPG Programmer's Guide in the 7.3 and 7.4 IBM Knowledge Center are updated with full information about this enhancement. Start at the What's New Since 7.3 or What's New Since 7.4 section in the Reference.

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SS69QP","label":"Rational Development Studio for i"},"Component":"ILE RPG Compiler","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.3;7.4","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
12 November 2020