This routine selects the current key of reference and positions the file pointer for the next NEXT or PREVIOUS routine. The START routine has five parameters, f, record, keynum, keysize and mode.
must be a valid file handle returned by OPEN.
points to the area to hold the record read.
selects which key to use. The corresponding key area in record must contain the key value that will be used to position the file.
indicates the size of the key. If keysize is zero, the entire key is used. Otherwise, only the first keysize bytes of the key will be used.
selects how the file is to be positioned with respect to the key value defined in record. It can be one of the following values:
F_EQUALS | The file is positioned at the record that matches the key value |
F_NOT_LESS | The file is positioned at the record that matches the key value, or the next greater one if no one matches |
F_GREATER | The file is positioned at the first record greater than the key value specified |
F_LESS | The file is positioned at the last record smaller than the key value specified |
F_NOT_GREATER | The file is positioned at the record that matches the key value, or the last record smaller than the key value if no one matches |
The F_EQUALS mode is usually used to test for the existence of a record or to position a file when the key value is known. The F_NOT_LESS and F_GREATER modes are used to position the file for a series of NEXT calls and the F_LESS and F_NOT_GREATER modes are used to prepare for a series of PREVIOUS calls.
After a successful START, the current key of reference will set to keynum. The next NEXT or PREVIOUS call will return the record selected by the START routine. Note that in this case, NEXT and PREVIOUS both return the same record.
If the START routine fails, then the current key of reference is placed in the "undefined" state.
Some file systems cannot perform the F_LESS or F_NOT_GREATER modes. On these file systems, specifying these modes causes START to return an error and set the E_NO_SUPPORT condition.