KEYOPTS - key options for the BSORT command.

(+|-)ASCending (+)       (+|-)DEScending (-)
(+|-)Error (+)           (+|-)IgnoreLeading (-)
FRom=position            Before=position
Field=number             IgnoreLeading=string
Length=length            Offset=position
SKip=string              STop=string

Key-Strings

Key-strings may be given on the command line following the "Key=" option or in a keyfile named with the "KeyFile=" option. Key-strings which contain blanks must be surrounded by double or single quotes. If a string within the key-string also contains blanks, the string must be enclosed in single or double quotes, whichever is NOT being used to enclose the entire key-string. (You may also double the quote character, e.g.

key="+des,skip="":"",+octal"

to obtain quotes inside quotes.)

Key-strings are made up of a number of items describing a single sorting key. These items may be separated by commas or blanks.

The following key-options may appear as items in a key-string. The "+" character that precedes some options may be omitted if desired.

Order Options

+ASCending
indicates that the particular key should be sorted in ascending order. This is the default. Specifying this for a single key overrides +ASCending or +DEScending on the command line.
+DEScending
indicates that the particular key should be sorted in descending order. Specifying this for a single key overrides +ASCending or +DEScending on the command line.

Key Location Options

FRom=position
indicates that the key starts from the given position in the record. For example, "from=10" indicates that the key begins in column 10 of the record. The many ways of specifying a "position" within a record are described in a later section; suffice it to say that the position can be described according to words, bytes, bits, etc. The default is "fr=0" so that the key begins at the very start of the record.
Before=position
indicates that the key is located before the given position in the record. The default for "position" is the length of the record, so that the key may be anything before the end of the record.
Length=length
specifies the length of the key. This length takes the same form as "position" within records (so that it can be given in bits, bytes, words, etc.). The default length normally includes everything up to the "Before=" position; however, if "Field=" is specified for the key, the default length includes everything up to the end of the field (as indicated by the characters in the "STop=" string -- see below).

Key-Field Scanning Options

BSORT provides facilities which allow you to parse records into fields which may then be used as sort keys.

STop=string
gives a string which contains all the characters which may be considered to mark the end of a field. For example,
stop=":"

indicates that fields in the record are delimited by colons. If "STop=" is not specified for a particular key-field, the default is the "STop=" specified on the command line. When "STop=" is used in a key-string, the "Field=" option must also be specified.

SKip=string
gives a string which contains all the characters which may be skipped before beginning to search for the field. For example,
skip=":"

indicates that BSORT should skip over extraneous colons before beginning to collect the key. If "SKip=" is not specified for a particular key-field, the default is the "SKip=" specified on the command line. When "SKip=" is used in a key-string, the "Field=" option must also be specified.

IgnoreLeading=string
gives a string which contains all the characters which may be ignored at the beginning of a key-field after the "skip" characters have been skipped. For example,
il=" "

indicates that BSORT should ignore blanks which appear at the beginning of the key-field. The "IgnoreLeading=" option may be used even if "Field=" is not specified for the key.

+IgnoreLeading
indicates that BSORT should use the default "IgnoreLeading=" string specified on the command line. This option may be used even if "Field=" is not specified for the key.
-IgnoreLeading
indicates that BSORT should not ignore any characters once a key-field has been located. This option may be used even if "Field=" is not specified for the key. This is the default.
Offset=position
indicates that the key begins at the given offset from the beginning of the field, once the "skip" characters and the "ignore" characters have been skipped. The default is zero.
Field=number
indicates which field you want to be the actual key. For example,
field=3,stop=":"

indicates that you want the third field of a record in which fields are delimited by colons. BSORT will find this third field in the following way.

The first field begins at the start of the record. To find the second field, BSORT skips over "SKip=" characters in this first field and then looks for the first "STop=" character. The second field begins immediately after this "stop" character. BSORT will skip over skip characters in this second field, then start looking for another "stop" character. The third field begins immediately after this second "stop" character. BSORT will then ignore "IgnoreLeading=" characters at the beginning of this third field until the actual key is found.

Miscellaneous Key Options

-Error
indicates that the entire record should NOT be marked as erroneous even if this particular key is in error. The default is +Error.

See Also:

expl bsort
full description of BSORT
expl bsort batch
using BSORT in batch
expl bsort collate
collating orders
expl bsort errors
error handling
expl bsort examples
examples of BSORT operations
expl bsort notes
miscellaneous notes
expl bsort options
general command line options
expl bsort position
key position descriptors

Copyright © 1996, Thinkage Ltd.