RPG/400 Help

SORTA (Sort an Array)

*---------*---------------*-----------------*----------------*---------------*
|   CODE  |    FACTOR 1   |     FACTOR 2    |     RESULT     |  INDICATORS   |
|         |               |                 |      FIELD     |               |
*---------*---------------*-----------------*----------------*---------------*
| SORTA   |               | Array name      |                |               |
*---------*---------------*-----------------*----------------*---------------*

Factor 2 contains the name of an array to be sorted. The array is sorted into sequence (ascending or descending), depending on the sequence specified for the array in position 45 of the extension specifications. If no sequence is specified, the array is sorted into ascending sequence. The array *IN cannot be specified in factor 2 of a SORTA operation. A related array, such as a second array defined on the same extension specification, is not sorted. Only the array specified in factor 2 is sorted.

Figure 56. SORTA Operation

*...1....+....2....+....3....+....4....+....5....+....6....+....7...
E....FromfileTofile++Name++N/rN/tbLenPDSArrnamLenPDSComments
E                    ARRY        8  1  A
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++
C*  The SORTA operation sorts ARRY into ascending sequence because A
C*  is specified in position 45 of the extension specifications.
C*  If the nonsorted ARRY contents were GT1BA2L0, the sorted ARRY
C*  contents would be ABGLT012.
C*
C                     SORTAARRY


[ Top of Page | Previous Page | Next Page | Table of Contents ]