Use this command to find a record in any file, either TAS (opened with the OPENV (Open File) command) or non-TAS.
|Required - This is the type of FIND you want to execute. The options are M, G, F, L, N P, R:
M - matching - Find the exact record based on the search_value option. You can also set the appropriate key fields with the EQUAL command and then the search_value option need not be used.
G - generic - Same as match however the program will return the exact or next greatest record.
F - first - Find the first record in the file.
L - last - Find the last record in the file.
N - next - Find the next record. This assumes that you have done a search previously that successfully found a record in the file (exact, generic, first, etc.).
P - previous - Find the previous record. This assumes that you have done a search previously that successfully found a record in the file (exact, generic, last, etc.).
|This is the file handle/number value that is returned in the OPENV command. If you do not include this option, the program will look for a default file_number set in the SRCH command. If that default hasn't been previously set, the program will report an error and the command will be skipped. This entry will override any default file_number value set in the SRCH command.
NOTE: In this case you DO NOT preface the file number/handle field with the '@' symbol.
|Set this to the appropriate value to search the records in the file in the correct order. If you do not include this option, the program will look for a default key set in the SRCH command. If a default key hasn't been previously set, the program will report an error and the command will be skipped. This entry will override any default value set in the SRCH command.
VAL f/c/e1,f/c/e2,...,f/c/ex This is similar to setting each segment in the key to a value separately. If the index you're searching on has multiple segments you may list the proper value for each segment, separating them with commas. This will allow you to specify the exact type for each of the segments. For example, suppose you're searching on an index that has two segments: a 5 character alpha and an I type field. Each record you want has the same alpha, but the I field will change, and is in order. In the first record the I type field has a value of 0. The following would find the first record for that group, if it exists:
Notice that we separate the values with a comma. The only requirement is that the values be of the same type (and size) as the segments in the key. In this case we put the I type constant specifier (!) after the 0 to make sure that it is passed as an I type field.
|If you specify a label here, the program will transfer control to the appropriate line if an error occurs during the command.
NOTE: We do not recommend using this method to check for an error. You can test for an error with the FLERR() function and create a more graceful process to continue operation rather than just a GOTO, which is the effect of this option.
|You would use this option to filter the records read in this command. If the expression resolves to .FALSE. the search for a record will continue until the expression returns .TRUE. for a record or the search reaches the end of the file.
NOTE: This options works with any of the FINDV types. So, for example, if you are searching for the Last record (L option above) and use the FOR filter the command will return the last record found that matches the filter you have used.
|If this option is included in the command the program will NOT lock the record upon finding it as it would normally do in a multi-user situation. The default operation is to place a lock on the record upon reading it.
|If this option is included in the command the program will search only for the key. The result is that you can use this method for checking if a key value exists without having to find the entire record. This will preserve the values in your record until you are ready to save it. To test whether or not the record exists use the FLERR() function without specifying the file number. Note from User : The keyo option only works on new records that have not yet been saved.
|Normally, during a M (match) type FIND, if a record is not found the program will clear the record buffer. If you don't want this to happen then include this option. If a record was active before the FIND it will still be active. If you had data as part of a new record then that data will still be there.
Generally, if an error is returned during the FINDV operation the record for that file will not be active and will be cleared (no active data). However, this is not the case for the NEXT/PREVIOUS options. If there is an active record in the buffer and the user/program attempts a NEXT or PREVIOUS and reaches the end/beginning of the file, that record will still exist and will still be active.
You can use this command to search for a value in a non-TAS file by setting the KEY to @0 (or by not including it at all) and putting the value you are searching for as a logical expression in the FOR option. For example:
FINDV f ..... FOR fld_name='ABCD'
Where fld_name is a field in the non-TAS file being searched. The command above will return the first occurrence of the value 'ABCD'.
FINDV M fnum bkarcust_hndl key bkar.custcode value custcode