Vfind
See Also: Find, Found global indicator
Purpose
To provide find commands in programs whose parameters can be changed by users at run time. This command is usually not used when working with Data Dictionaries.
Syntax
vfind
table_number index_number mode
Argument Explanation
- table_number: The number of the table to find records from.
- index_number: The number of the index to use to find records.
- mode: The find mode. It may be any of the following names or numbers:
lt(0)le(1)eq(2)ge(3)gt(4)
What It Does
The vfind command is useful for programs that need to perform finds where the table, index, and mode are to be defined at runtime. Often, this information is provided through parameters passed to a procedure or function.
The found predefined indicator is set to return the result of the find operation.
Procedure WriteRecords Handle hTable Integer iIndex Integer iCount
Integer iCounter
for iCounter from 1 to iCount
vfind hTable iIndex GT
// found indicator can be evaluated within parentheses
If not (Found) ;
Procedure_Return
Send WriteData
Loop
End_Procedure
This example shows how a procedure is passed a file and index to be used for record finding. It also shows how the found indicator is tested after each find to determine if the find was successful.
Notes
- Like the other database commands,
vfindrequires the database table it addresses to be open. - Records found using the
vfindcommand do not affect records or information within a Data Dictionary Object (DDO). If you want your DDO to "know" about a record found with thevfindcommand, you must send the messagerequest_assignto the DDO.