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:
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.
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
Specify one of the following:
AP Ascending sort; field specified by column number.
DP Descending sort; field specified by column number.
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.
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:
ARG n MISSING OR INVALID
STACK NOT SPECIFIED AND NO DEFAULT
SPECIFIED STACK DOES NOT EXIST
SPECIFIED IMOD NOT FOUND
STACK WRITE FAILED
REQUESTED STACK DOES NOT EXIST
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 © 2012 CA. All rights reserved. | Tell Technical Publications how we can improve this information |