IBM Support

RPG Cafe: Spring 2023: SELECT statement with an operand

News


Abstract

RPG enhancement delivered through PTFs in the spring of 2023. SELECT statement with an operand

Content

You are in: RPG Cafe > RPG Cafe: Spring 2023: SELECT statement with an operand

Short URL: https://ibm.biz/rpgcafe_spring_2023_select_with_operand

Spring 2023: SELECT statement with an operand

When the SELECT statement has an operand, the WHEN-IS and WHEN-IN statements are used for the comparisons.

  • If the operand of the SELECT statement is equal to the operand of the WHEN-IS statement, the statements in the WHEN-IS block are chosen.
  • If the operand of the SELECT statement is in the operand of the WHEN-IN statement, the statements in the WHEN-IN block are chosen. The operand of the WHEN-IN statement can be
    • %RANGE
    • An array
    • %SUBARR
    • %LIST

Example

          dcl-s i int(10);
          dcl-s n int(10);
          dcl-s arr1 packed(10) dim(100);

          select i + 1;
          when-in %list(1 : 3 : 5 : 7);
             dsply ('i+1 is one of 3, 5, 5, 7 ... i = ' + %char(i));
          when-is n;
             dsply ('i+1 = n, so this block is chosen ... n = ' + %char(n));
          when-in arr1;
             dsply ('i+1 is equal to an element of arr1 ' + %char(i));
          other;
             dsply ('i+1 has some other value');
          endsl;
.                                                            .
.                                                            .

PTFs for 7.4, and 7.5

7.4:

  • ILE RPG compiler: 5770WDS SI83497

7.5:

  • ILE RPG compiler: 5770WDS SI83480
  • ILE RPG compiler, TGTRLS(V7R4M0): 5770WDS SI83496

The PTFs are also available with Db2 for i Fix Packs. See Db2 for IBM i 2023 PTF Group Schedule.

RDi support

A later update for RDi will support these enhancements.

Documentation

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

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SS69QP","label":"Rational Development Studio for i"},"ARM Category":[{"code":"a8m0z0000000C4BAAU","label":"IBM i"},{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.4.0;7.5.0;and future releases"}]

Document Information

Modified date:
17 May 2023

UID

ibm16982199