ORDER

Sort the resource table records in a result set.

Read syntax diagramSkip visual syntax diagramORDERBY(data-area) LENGTH(data-value) RESULT(cpsm-token) THREAD(cpsm-token) RESPONSE(data-ref) REASON(data-ref)

Description

This command sorts the resource table records in a result set into a user-specified order.
  • By default, records are sorted by the key attributes for the resource table.
  • The sort order you specify for a result set remains in effect until you issue another ORDER command.
  • If the result set contains deleted records, those records are included in the sorting process. They are sorted by the same attributes as other records and their position in the newly ordered result set may be difficult to determine. To prevent this happening, issue the REFRESH command before issuing ORDER; REFRESH removes any deleted records from the result set.

Related commands

COPY, GET, GETDEF, GROUP, LOCATE, PERFORM OBJECT

Options

BY(data-area)
Identifies a buffer containing the order expression to be used for this operation.
An order expression is a list of attributes to be used in sorting the resource table records. For example:
  CICSSYS,TRANID.
where the attribute names are separated by commas or blank spaces and the whole expression ends with a period.

In this example, the resource table records are sorted using CICS® system name as the primary sort key and transaction ID as the secondary key. The default sort order is ascending. To sort attribute values in descending order, add /D to the end of the attribute name.

For more information on using order expressions with the ORDER command, see Developing CICSPlex SM applications.

LENGTH(data-value)
A fullword value that specifies the length of the BY buffer.
Note: The buffer length you specify should not include any data other than an order expression.
REASON(data-ref)
Names a variable to receive the fullword reason value returned by this command.
RESPONSE(data-ref)
Names a variable to receive the fullword response value returned by this command.
RESULT(cpsm-token)
Identifies the API result set to be processed by this operation. The result set can be one produced by any of these commands:
  • COPY
  • GET
  • GETDEF
  • GROUP
  • PERFORM OBJECT.
THREAD(cpsm-token)
Identifies the API thread to be used for this operation. The cpsm-token value that identifies a thread is returned by the CONNECT command.

Conditions

The following is a list of the RESPONSE values that can be returned by the ORDER command. The description of each RESPONSE includes a list of associated REASON values, if appropriate.
OK
The command completed processing successfully.
BUSY
A busy condition occurred for the following reason:
RESULT
The result set specified on the RESULT option is being processed by another command.
ENVIRONERROR
An environment error occurred for one of the following reasons:
NOSERVICE
The application stub program could not load the API service module.
NOSTORAGE
The application stub program could not obtain the necessary storage in the address space where the processing thread is running.
SOCRESOURCE
A required resource that is owned by the CMAS is not available.
FAILED
The command failed for one of the following reasons:
ABENDED
Command processing abended.
EXCEPTION
Command processing encountered an exceptional condition.
INVALIDCMD
The command is invalid for the following reason:
LENGTH
The total length of all the options on the command exceeds the maximum limit.
INVALIDPARM
An invalid parameter was detected. The parameter that is invalid is returned as the reason value:
  • BY
  • LENGTH
  • RESULT
  • THREAD.
Check the command description for valid parameter syntax.
NOTAVAILABLE
A not available condition occurred for one of the following reasons:
APITASK
The API control subtask is not active.
CPSMAPI
The CMAS to which the processing thread is connected is not available for API processing.
SERVERGONE
The CMAS to which the processing thread was connected is no longer active.
VERSIONINVL
A version conflict occurred for one of the following reasons:
NOTSUPPORTED
The version of the application stub program used for this command is not supported.
NOTVSNCONN
The version of the application stub program used for this command is not the same as the version used with the CONNECT command.