Sorting the records in a result set

The records in a result set are normally sorted by the key attributes for that resource table.

In the case of CICS Resource and CICS Monitored tables, records are sorted by the CICS® system from which they were collected. In working with result sets, you may find it easier to process the records if they are in some logical order of your own choosing. The ORDER command in the CICSPlex® SM API lets you sort the records in a result set according to the values of a particular resource table attribute. If you are using the CICS management client interface (CMCI), use the ORDERBY parameter instead.

If you are using the CICSPlex SM API you can choose how the records are sorted by specifying an order expression on the BY option of the ORDER command. If you are using the CICS management client interface (CMCI) you can specify how the records are sorted using the ORDERBY parameter. An order expression is a character string that consists of one or more attribute names to be used in sorting the resource table records.

The syntax of an order expression for sorting records is:
Read syntax diagramSkip visual syntax diagram
Order Expression – Sorting Records

   .-,------------.      
   V              |      
>>---attr--+----+-+--.-----------------------------------------><
           '-/D-'        

where:
attr
Is the name of an attribute in the resource table.

You can specify as many attribute names as you like, but the total length of an order expression, including commas and blank spaces, must not exceed 255 characters.

/D
Indicates the attribute values should be sorted in descending order. By default, the values are sorted in ascending order.
Note: An order expression must be followed by either blank spaces or null characters to the end of the specified buffer. That is, the buffer length you specify (using the LENGTH option) should not include any data other than an order expression.
For example, to sort a result set of LOCTRAN records by transaction ID and enabled status, you could specify:
  TRANID,STATUS.

In this example, transaction ID is the primary sort key and enabled status is the secondary sort key.

To sort records in descending order of use count, add /D to the end of the attribute name, like this:
  USECOUNT/D


eyup1bc.html | Timestamp icon Last updated: Thursday, 27 June 2019