IBM Support

RPG Cafe: New built-ins %LOWER, %UPPER, and %SPLIT



RPG enhancement delivered through PTFs in the spring of 2021. New built-ins %LOWER, %UPPER, and %SPLIT


You are in: RPG Cafe > RPG Cafe: %LOWER, %UPPER, %SPLIT

Short URL:


New built-in functions %LOWER, %UPPER, and %SPLIT

  • %LOWER and %UPPER: You can convert all or part of a string to lowercase or uppercase.
  • %SPLIT: You can split a string into an array of substrings.


If you use the new built-in functions %LOWER, %UPPER, or %SPLIT in your program, you need a runtime PTF on any system where you run the program.



%LOWER converts all alphabetic characters to lowercase, and %UPPER converts all alphabetic characters to uppercase.

If you want to convert only some of the characters in the string, use the start and length operands to specify the substring to convert. The built-in function returns the entire string.

In the following example, %LOWER is used to convert the characters from position 2 to the end of the string to lowercase.

          string = 'RENÉE';
          string2 = %LOWER(string : 2);
          // string2 = "Renée"


%SPLIT returns an array of substrings.

By default, %SPLIT splits at blanks.

The second "separators" parameter can be a list of the characters you want to split at.

Leading and trailing separators are ignored. If there is more than one separator in a row, the extra separators are ignored.

You can use FOR-EACH to process the result of %SPLIT.

In this example, %SPLIT defaults to splitting at blanks. In second example, the second parameter specifies several characters to split at.

          array = %SPLIT(' a  bcd   ef');
          // array(1) = "a"
          // array(2) = "bcd"
          // array(3) = "ef"

          sentence = 'Hello, how are you?';
          FOR-EACH x IN %SPLIT(sentence : '.,:;!? ');
          // In the loop, 'word' has the values
          //    "Hello"
          //    "how"
          //    "are"
          //    "you"
.                                                            .
.                                                            .

PTFs for 7.3 and 7.4, available in April 2021


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, the calling program fails with MCH4437 saying that a program export is not found.

  • ILE RPG compiler: SI76100
  • ILE RPG runtime: SI76098


  • ILE RPG compiler: SI76101
  • ILE RPG compiler, TGTRLS(V7R3M0): SI76109
  • ILE RPG runtime: SI76099

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


You need the runtime PTF on any system where you run a program with the new %LOWER, %UPPER, or %SPLIT built-in functions.

RDi support

The next release of RDi will support these enhancements.


The 7.3 and 7.4 ILE RPG Reference and ILE RPG Programmer's Guide are updated with full information about these enhancements. Start at the "What's new cince 7.3" or What's new since 7.4" section in the Reference.

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure 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":"LOB57","label":"Power"}}]

Document Information

Modified date:
15 April 2021