IB Statements/inquire
From CometWiki
INQUIRE statement
Syntax: INQUIRE (lun, format-statement-label) [KEY=index] [,EXCP=statement-label | NOEXCP]
Discussion: The INQUIRE statement performs the same function as the READ statement, and is able to retrieve records that have been extracted.
Notes:
The INQUIRE statement is available in Comet 504 and greater. Executing the INQUIRE statement under previous versions of Comet generates an exception 91).
On type N directories, Comet uses system-level record locking to synchronize access to files. This includes EXTRACT. An INQUIRE statement cannot break into this record lock to get the record. Record locking is a facility provided by Windows/DOS. Since this feature is beyond Comet's control, performing an INQUIRE on an extracted record in a type N directory will result a wait until the record becomes available.
The CometServe file system, on the other hand, has control of all activity on each file. It is not subject to the same restrictions that record locking imposes. Thus, on type S directories, the INQUIRE statement is able to retrieve records that have been extracted.
The optional index parameter is used to access a particular record in a keyed file. If an index is not specified, the file is read in key-sequential order.
When the index parameter is used, the index (key) can be any valid string expression. If the key index is shorter than the file key size, it is padded with trailing blanks prior to the key search. If it is longer than the key size, excess trailing characters are truncated prior to the key search. If the key index is not found in the key list, the file pointer is positioned at the next key and an exception 32 is encountered.
The INQUIRE statement automatically advances the file pointer to the next record in the file.
- OPEN (1) "CUSTFILE"
.
.
INPUT (0) CUSTNUM$
INQUIRE (1,1000) KEY=CUSTNUM$, EXCP=9999