ERROR - how BSORT handles errors.

BSORT extracts all the key information from each record as it is read in. This information is added to the end of the record immediately, to make it easy to detect the keys when passing through the records.

In the course of extracting key information, several errors may occur; for example

If any of these situations occur, the key is in error. This would normally imply that the entire record is erroneous; however, if "-Error" was specified in the key-string for the erroneous key, the error is disregarded and the record is NOT marked as erroneous.

If the record is marked as erroneous, the "Error=" disposition is checked. If "Error=Stop" was specified on the command line, BSORT terminates.

If the "Error=" disposition is not "Stop", BSORT makes some attempt to include the record in the sorting process. Thus BSORT tries to correct the erroneous key. If the key is merely shorter than expected, it is padded to the correct length by adding zero bits on the right. With character data, this means appending ASCII nulls (octal 000); with numeric data, this essentially means adding "0" characters. The expanded key is added to the key information on the end of the record so that it can participate in the sorting process. Any erroneous EIS data field will be set to negative infinity (so that it will sort first if +AScending is specified).

If the key is missing or invalid for some reason, a key consisting of zero bits is supplied. With character data, this means a string of ASCII nulls; with numeric data, this means the number zero. The supplied key is added to the key information on the end of the record.

If the "Error=" code is "Report" or "Ignore", erroneous records will be written to the RejectFile (if one exists) after all the records have been sorted. Thus the RejectFile will always be sorted, making it easier to merge erroneous records with the correct ones, if desired. If the "Error=" code is "First" or "Last", erroneous records will appear in the appropriate location within the sorted output and will NOT be written to the RejectFile.

If "-Error" is specified in the key-string, the erroneous key is padded or supplied with zero bits without marking the entire record as erroneous. The sort takes place using this zero value. Since the record is not regarded as erroneous, it is not written to the RejectFile.

See Also:

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

Copyright © 1996, Thinkage Ltd.