7 89 SORT_LIST

LANSA Technical

7.89 SORT_LIST

The SORT_LIST command is used to sort a list into a nominated sequence.

The list specified must be a working list (used to store information within a program). It is not possible to use the SORT_LIST command against a browse list (used for displaying information at a workstation).

Sorting a Static Working List or a Dynamic Working List with all its entries in a single block of memory is accomplished by sorting the entries in place.

When a Dynamic Working List has its entries across multiple blocks of memory, Visual LANSA performs the sort by allocating a single block of memory; filling the block with pointers that address each entry in the working list and then sorting the block of pointers.

While this technique enables the SORT_LIST command to work with Dynamic Working Lists managing multiple blocks of memory, the SORT_LIST command has a limitation – it must allocate a single block of memory that can contain a pointer to each entry in the working list:

  • For the IBM i where each pointer is 16 bytes and the maximum block size is 16MB, only 1MB of entries can be sorted.
  • For 32-bit Windows system where a pointer is 4 bytes and it is theoretically possible to allocate a 1GB block of memory, the limit is much higher.

Refer to the 7.23 DEF_LIST command for further information of lists and list processing.

Also See

7.89.1 SORT_LIST Parameters

7.89.2 SORT_LIST Examples

                                                         Optional

 

  SORT_LIST ---- NAMED -------- *FIRST ------------------------->

                                name of list

 

                 BY_FIELDS ---- name of field --- *ASCEND ------|

                             |                    *DESCEND |

                             | expandable group expression |

                              -------- 100 maximum --------