IBM Support

RPG Cafe: Fall 2021: Sort a data structure array by multiple subfields

News


Abstract

RPG enhancement delivered through PTFs in the fall of 2021. Use %FIELDS to list the subfields for sorting a data structure array.

Content

You are in: RPG Cafe > RPG Cafe: Fall 2021: Sort a data structure array by multiple subfields

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

Fall 2021: Sort a data structure array by multiple subfields

Details

If you want to sort a data structure array by more than one subfield, you can use %FIELDS to list the subfields.

For the following SORTA operation:

          SORTA info %FIELDS(price : quantity);
  • When info(i) is compared to info(j), and info(i).price is not equal to info(j).price, then it is not necessary to compare info(i).quantity to info(j).quantity.
  • However, if the price subfields are equal, then info(i).quantity is compared to info(j).quantity to determine the order of info(i) and info(j).
.                                                            .
.                                                            .

PTFs for 7.3 and 7.4, available in September 2021

7.3:

  • ILE RPG compiler: 5770WDS SI77165

7.4:

  • ILE RPG compiler: 5770WDS SI77166
  • ILE RPG compiler, TGTRLS(V7R3M0): 5770WDS SI77167

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

Documentation

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 since 7.3" or What's new since 7.4" 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":[],"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.3.0;and future releases"}]

Document Information

Modified date:
09 September 2021

UID

ibm16481975