![]() | ![]() | ![]() | ![]() | ![]() |
This is a rexx function provided by PPWIZARD. This routine (like all PPWIZARD extensions) can be used with any operating system supported by PPWIZARD.
This function is used to sort a rexx array. The "array" has numeric indexes with the ".0" element holding the number of elements. The array can hold numbers or strings.
The sort is always ascending. You can use the ReverseArray() routine if required.
The function takes 1 or more parameters as follows:
The routine returns the number of items in the array.
If you are sorting a very large array with a fixed known name then you might wish to have a look at the faster and more powerful PPWSORT.H header file.
;--- Set up the array ------------------------ #evaluate '' \ ^ \ A.1 = "ASDFG"; \ A.2 = "4123"; \ A.3 = "61743"; \ A.4 = "1678"; \ A.0 = 4; \ ^ ;--- Sort array & display -------------------- #evaluate '' ^call SortArray "A"^ #evaluate '' ^do I = 1 to A.0; say '"'a.i'"'; end; say ''^ ;--- Sort array (start column 3) & display --- #evaluate '' ^call SortArray "A", 3^ #evaluate '' ^do I = 1 to A.0; say '"'a.i'"'; end;
![]() | ![]() | ![]() | ![]() | ![]() |