Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Mach SIx v1.1c - Reference Guide - <b>sort - copy to a new table in sorted order</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  SORT             - Copy to a new table in sorted order
------------------------------------------------------------------------------

  Syntax:

  SORT TO <xcDatabase> ON <idField> [/[A | D][C]]
            [, <idField2> [/[A | D][C]]...]
            [<scope>] [WHILE <lCondition>] [FOR <lCondition>]
            [NOOPTIMIZE]

  Arguments:

  TO <xcDatabase> is the name of the target file for the sorted
  records and can be specified either as a literal filename or as a
  character expression enclosed in parentheses.  Unless otherwise
  specified, the new file is assigned a (.dbf) extension.

  ON <idField> is the sort key and must be a field variable.

  /[A|D][C] defines how <xcDatabase> is to be sorted.  /A sorts in
  ascending order.  /D sorts in descending order.  /C sorts in dictionary
  order by ignoring the case of the specified character field.  Unless
  otherwise specified, the default SORT order is ascending.

  <scope> is the portion of the current database file to SORT.  The
  default is ALL records.  Mach SIx only supports the ALL scope.

  WHILE <lCondition> specifies the set of records meeting the
  condition from the current record until the condition fails.
  Mach SIx does not support the WHILE condition.

  FOR <lCondition> specifies the conditional set of records to SORT
  within the given scope.  Mach SIx will optimize any conditon that
  contains at least one or more active index keys.

  Description:

  SORT is a database command that copies records from the current work
  area to another database file in sorted order.  Clipper SORTs character
  fields in accordance with the ASCII value of each character within the
  string unless the /C option is specified.  This option causes the
  database file to be SORTed in dictionary order--capitalization is
  ignored.  Numeric fields are SORTed in numeric order, date fields are
  SORTed chronologically, and logical fields are sorted with true (.T.)
  as the high value.  Memo fields cannot be SORTed.

  SORT performs as much of its operation as possible in memory and then
  it spools to a uniquely named temporary disk file.  This temporary file
  can be as large as the size of the source database file.  Note also
  that a SORT uses up three file handles: the source database file, the
  target database file, and the temporary file.

  The SORT command may be optimized by specifying one or more active index
  keys in the FOR condition.  Note that Mach SIx will only optimize a SORT
  with a FOR condition and a scope of ALL.  WHILE conditions and alternate
  scopes cannot be optimized by Mach SIx.

  In a network environment, the database file to be SORTed must be locked
  with FLOCK() or USEed EXCLUSIVEly.

  Notes:

  Deleted source records: If DELETED is OFF, SORT copies deleted
  records to the target database file and the deleted records retain
  their status.  If DELETED is ON, deleted records are not copied to
  the target database file.

  SET EXACT: SET EXACT has no effect on SORTing.

  ---------------------------------| EXAMPLE |--------------------------------
  /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  *  Demonstrates an optimized SORT command                                 *
  *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/

  #include "DBFSIX.CH"
  #include "MACHSIX.CH"

  USE Account VIA "DBFSIX"  // Structural index ACCOUNT.CDX opened
                            // automatically
  CLEAR SCREEN
  ? "Example of an optimized SORT command."
  ?
  SORT ON Last+First TO Temp

  USE Temp

  Browse()



Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson