SORT
Define SORT File
This directive is used to create a new, single-keyed file in a logical disk directory containing only keys, no data.
Syntax
Section titled “Syntax”SORT file-name, key-size, num-keys, disk-num, sector-num[,ERR=line-ref|,ERC=error-code]file-name- is any string of 8 characters or fewer used to name this file.
key-size- is an integer in the range of 1 to 144 indicating the size, in bytes, of this file's key.
num-keys- is an integer in the range of 0 to 16,777,215 indicating the maximum number of keys to be contained in this file.
disk-num- specifies the logical disk directory that contains this file. Valid values are 0 through 35.
sector-num- is the sector number. The only valid value is 0.
line-ref- is the program line number or label to branch to if this directive produces an error.
error-code- is a programmer-defined error code. Valid values are positive or negative whole numbers.
Remarks
Section titled “Remarks”If any integer range is exceeded, an ERR=41 results.
If a file-name of more than eight characters (operating system-dependent) is specified, an ERR=10 results.
File-name must be unique in the execution environment. An attempt to define a same-name file already defined on an available logical disk directory results in ERR=12.
File-name may contain any ASCII characters, unprintable as well as printable. Avoid the using characters, which have special meaning in different operating system environments (e.g. “ * “ in UNIX and Microsoft Windows, “ / “ in UNIX, “ # “ and “ \ “ in Microsoft Windows, etc.).
Do not use device or task names as file names. For example, do not use T0 - T9, TA - TZ, Ta - Tz, D0 - Dz, LP, P0 - Pz, G0 - Gz, C0 - Cz. In general, most device and task names use two-character names. The simplest approach is to not use two-character file-names.
All valid values for sector-num are treated as 0, but syntax requires sector-num to be specified.
Starting with release level 8.3.1, you can define num-keys as 0. This dynamic file type has no EOF (end of file) restrictions, so the necessity for file expansion is removed. The file can contain more than 2 billion records and 140 trillion characters.
Starting with release level 8.3.1, you can use the READ RECORD (channel) string-variable directive to access a SORT file. For more information, please refer to the description of the READ directive.
Examples
Section titled “Examples”SORT "SEAL", 10, 57, 2, 0creates a SORT file named SEAL with the following parameters: key length is 10 bytes, 57 keys, and a location on logical disk 2 starting at a sector allocated by the operating system.
SORT A$, A, B, D, E, ERR=7999If A$=“SEAL”, A=10, B=57, D=2, and E=0 has the same effect as the first example, and branches to statement 7999 if this directive produced an error.
See also
Section titled “See also”ADDSORT, DIRECT, ERASE, FILE, INDEXED, INITFILE, REMSORT, SERIAL, TEXT, and TISAM directives
From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF