Use the SORT() function to sort records on any stack belonging to any IMOD. Up to six fields can be sorted on simultaneously, with the sorting precedence running from left to right.
SORT() can specify a stack external to an IMOD only when the target stack has been declared public for writing.
The SORT() function has this syntax:
SORT([stack],[owner],[order,field,leng],...,[order,field,leng])
The SORT() function takes these arguments:
|
stack |
Number of the stack to be referenced. Default: If a local stack is referenced, the current stack (as set by the SWAPSTAK() function); otherwise, the value is set by the owning IMOD task using the PUBSTACK(DEFAULT) function. |
|
owner |
IMOD ID of the stack's owner (for external reference). This value can be obtained from the variable imod_id in the owning IMOD task. It is also the value returned by the SPAWN() function. Default: Current IMOD task |
|
order |
Specify one of the following: AP Ascending sort; field specified by column number. DP Descending sort; field specified by column number. |
|
field |
Defines the start of a field. For column-specified fields (type = AP and DP), this is the column number of the start of the field. |
|
leng |
Length of a sort field. For column-specified fields (type = AP and DP), this is the number of characters in the field. |
The SORT() function produces these return codes:
101 - 120 ARG n MISSING OR INVALID
122 STACK NOT SPECIFIED AND NO DEFAULT
123 SPECIFIED STACK DOES NOT EXIST
125 SPECIFIED IMOD NOT FOUND
126 STACK WRITE FAILED
127 REQUESTED STACK DOES NOT EXIST
128 SPECIFIED IMOD/STACK NOT AUTHORIZED
Example
x = sort(0,2,'AP',7,10,'AP',1,6)
/* Sort IMOD 2's stack 0. Sort the records
by the 10-character field starting in
column 7. Within equal records, sort on
the 6-character field beginning in
column 1. */
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |