FRANCAIS

AS400 / ISERIES SORT OPTIONS


SORT SPECIFICATIONS SUBFILE SORT EXAMPLE ARRAY SORT
QSORT API DDS KEY SEQUENCE USER INDEX


SORT SPECIFICATIONS
Sort Specifications are used to sort one or more input files into one output file. The specifications are keyed into a source member and processed by the FMTDTA command. These specifications use from and to positions - they do not connect to the external specifications (if any) of a physical file.
Documentation is available from the IBM InfoCenter on this link
-->TOP


SUBFILE SORT EXAMPLE
This source member illustrates how to use a physical file with RPG-ile to sort records in a subfile. This is a bare-bones example - only the RPG source statements are given. The included documentation is comprehensive. It is useful for those who do not wish to use the QSORT api. Although is is designed for subfile records, it can be changed to sort arrays.
Use this link to download the source member as a text file
-->TOP


ARRAY SORT
The SORT Array operation code - SORTA - sorts an array into ascending or descending sequence. The ASCEND or DESCEND keyword is specified with the array definition on the D specification. If neither is specified, ASCEND is assumed. SORTA can be specified in both fixed and free form specifications. SORTA takes one parameter - the name of the array to be sorted OR %SUBARR . All the array elements are sorted with SORTA. %SUBARR can be specified with SORT to specify a subset of elements in an array. The elements specified in %SUBARR must be contiguous.
Documentation is available from the IBM InfoCenter on this link
-->TOP


QSORT API
The QSORT api will sort an array into ascending or descending sequence. This is really a C api, but can be coded within RPG.
Documentation is available from the IBM InfoCenter on this link
-->TOP


DDS KEY SEQUENCE
In physical and logical files, the records can be read in a key sequence by specifying one or more key fields. The default is for the records to be in ASCENDing sequence. The DESCEND keyword puts the records in the opposite sequence. There is no ASCEND keyword. When using a signed numeric field as a key field with the DESCEND keyword, negative numbers are equivalent to positive numbers unless the SIGNED keyword is also specified. Select and omit parameters can be specified on a logical file to filter records.
Documentation is available from the IBM InfoCenter on this link
-->TOP


USER INDEX
A USER INDEX is an index which exists as a stand-alone object type *USRIDX. It is an ordered list which is maintained through a set of API's. Compared with a database file, a user index is faster for searching large sets of simple lookup data such as a list of abbreviations or a telephone directory.
Documentation is available from the IBM InfoCenter on this link
-->TOP




Use the Contact Us tab if you wish to email us.