User's Guide

MTBSORT

Sorts all the columns of an image based information system (IBIS) tabular file based upon one or more control key columns (SORTCOL).

Function:

Sorts all the columns of an image based information system (IBIS) tabular file based upon one or more control key columns (SORTCOL).

Parameters:

INFILE
Input file. The input IBIS tabular file to be sorted.

SORTCOL
Sort column(s). The columns to use as control key columns in sorting the file. The first value in SORTCOL is the primary sort column. Subsequent columns are used, as necessary, to determine order within limits established by equal values from previous sorts.

INDEXCOL(--)
Index column number. In the sorting process, a temporary column is created which holds the index numbers assigned to each unique combination of numbers in the sorted columns. This index column may be retained for future use by specifying a column number in INDEXCOL. The index column will replace the original values of this column in the tabular file. The default value indicates that the index column should not be saved.

LOGORDER(ASC)
Logical order. The order in which the sort is performed. The default value is ascending order.


  =  ASC:  Ascending.  Columns are sorted in ascending
           order.
  =  DES:  Descending.  Columns are sorted in descend-
           ing order.

Examples:

  1. LAS> mtbsort infile=tab sortcol=1 logorder=des

    The tabular file is sorted into descending order using column 1 as the primary sort column. The index column is not saved.

  2. LAS> mtbsort infile=tab sortcol=(2 3) indexcol=1

    The tabular file is sorted into ascending order using column 2 as the primary sort column and column 3 as the secondary one. The index column is written to the tabular file as column 1.

Description/Algorithm:

The program begins with the standard initialization and retrieval of the user-specified parameters. The IBIS tabular file is opened. Two temporary arrays are used. The first holds the data to be sorted, and the second is used to define the boundary limits. Limits are defined using an index number indicating a portion of the file to be sorted. The boundary index is initialized to 1 indicating the entire column is to be sorted. If subsequent sorts need to be made on the file for a multiple column sort, the index number is broken into groupings of the same number indicating the sort limits. The holding array is sorted each time the sort index changes. At the completion of the sort process, the reordering is in the form of pointers. The pointers are used to move all columns of the file one at a time. The limit array serves as an index.

Nonfatal Error Message:

  1. [mtbsort-close] Error closing input file

    An error was encountered while closing the input file. The data may still be valid.

Fatal Error Messages:

  1. [mtbsort-fatal] Fatal error encountered

    A fatal error was encountered during sorting. The IBIS tabular file may or may not be valid. The message that is displayed immediately preceding this message is the specific error that was encountered.

  2. [mtbsort-open] Error opening file

    An error was encountered while trying to open the IBIS tabular file.

User Notes:

    None.