DQBsort
SUB

Prototype

DECLARE SUB DQBsort (BYVAL ArraySeg, BYVAL ArrayOff, BYVAL NumRecords,
                     BYVAL RecordLen, IndexOff)

Parameters

ArraySeg - Segment of the array of integers to sort; use VARSEG

ArrayOff - Offset of the array of integers to sort; use VARPTR

NumRecords - Total number of records to sort

RecordLen - Length of each record in bytes

IndexOff - Offset of the integer index value within a record

Returns

none

Description

DQBsort uses a fast bubble sort algorithm to sort a given array of records, by comparing the index number (that must be an integer) of each record and sorting the correspondent records from the lower value to the higher one of it. The index field can be anywhere within the record, and you can specify its position by using the IndexOff parameter, that is relative to the beginning of a record (i.e. IndexOff=0 means the first field of a it). RecordLen is the number of bytes of each record.

Notes:

A record can contain any type of data, and DQBsort will sort it by comparing the index numbers. You can also sort a simple array of integers, by passing 2 as RecordLen (an integer is 2 bytes long) and 0 as IndexOff.