The ILE RPG feature (an option of the IBM® WebSphere® Development Studio for iSeries™ licensed program) provides the possibility for a user to specify a sort sequence table and use it in comparison operations performed with non-numeric data.
For each of the supported languages, two tables (a shared-weight and unique-weight) are included with the server. With sort sequence support you can create sort sequence tables based on the existing ones.
The control specifications are specifications that provide the ILE RPG for iSeries compiler with information about your program and your server. The sort sequence used in ILE RPG for iSeries programs is controlled by all of the following items:
The alternative collating sequence field (ALTSEQ) in the control specifications allows the following values:
The SORTA and LOOKUP operation codes do not use specified alternative collating sequence tables.
The SRTSEQ and LANGID parameters on the Create RPG Module and Create Bound RPG Program commands are ignored.
The SORTA and LOOKUP function with the arrays and tables at compile time and processing time take effect only when you specify D in the control specifications.
The sort sequence table to be used by the program can be determined at compile time or when the job is run. If the SRTSEQ parameter of the Create RPG Module and Create Bound RPG Program commands:
The implementation of compare operation codes, match field and control field processing with the sort sequence tables is the same for the alternative collating sequence and for the sort sequence support. Compare operation codes are ANDxx, COMP, CABxx, CASxx, DOUxx, DOWxx, IFxx, ORxx, and WHxx. Additional functions provided with the SORTA and LOOKUP operation codes follow:
The search argument and either the table or array element are compared using the sort sequence table.
The array and table data are checked using the sort sequence table, whenever ascending or descending sequence is specified. If the SRTSEQ and LANGID parameter values resolve to retrieve the sort sequence table again at run time, then the array and table elements are loaded without a sequence check at the compile time. The sequence checks are performed at run time, according to the sort sequence table.