Sign in

docs RPG Reference

Sequence Checking for Character Arrays

Sequence Checking for Character Arrays

Sequence checking for character arrays that have not been defined with ALTSEQ(*NONE) has two dependencies:

  1. Whether the ALTSEQ control specification keyword has been specified, and if so, how.
  2. Whether the array is compile time or prerun time.

The following table indicates when sequence checking occurs.

Control Specification EntryALTSEQ Used for SORTA, LOOKUP and Sequence CheckingWhen Sequence Checked for Compile Time ArrayWhen Sequence Checked for Prerun Time Array
ALTSEQ(*NONE)NoCompile timeRun time
ALTSEQ(*SRC)NoCompile timeRun time
ALTSEQ(*EXT) (known at compile time)YesCompile timeRun time
ALTSEQ(*EXT) (known only at run time)YesRun timeRun time

Note: For compatibility with RPG III, SORTA and LOOKUP do not use the alternate collating sequence with ALTSEQ(*SRC). If you want these operations to be performed using the alternate collating sequence, you can define a table on the system (object type *TBL), containing your alternate sequence. Then you can change ALTSEQ(*SRC) to ALTSEQ(*EXT) on your control specification and specify the name of your table on the SRTSEQ keyword or parameter of the create command.