Sign in

docs RPG Reference

Array Operations

Array Operations

The array operations are shown in the following table.

Table 1. Array Operations

OperationTraditional SyntaxFree-Form Syntax
Look Up ElementsLOOKUP (Look Up a Table or Array Element)%LOOKUPxx (Look Up an Array Element) or %TLOOKUPxx (Look Up a Table Element)
Number of Elements%ELEM (Get Number of Elements)
Move an ArrayMOVEA (Move Array)(not allowed)
Sort an ArraySORTA (Sort an Array)SORTA (Sort an Array)
Subset an Array%SUBARR (Set/Get Portion of an Array)
Sum the Elements of an ArrayXFOOT (Summing the Elements of an Array)%XFOOT (Sum Array Expression Elements)
Find the Maximum or Minimum Value in an Array%MAXARR and %MINARR (Maximum or Minimum Element in an Array)

While many operations work with arrays, these operations perform specific array functions. See each operation for an explanation of its function.