![]() ![]() |
|
READVThe READV statement allows a program to read a specific field from a record in a previously opened file into a variable.
COMMAND SYNTAXREADV variable1 FROM { variable2,} expression1, expression2 {SETTING setvar} {ON ERROR statements} THEN|ELSE statements
SYNTAX ELEMENTSvariable1 is the identifier into which the record will be read. variable2, if specified, should be a jBC variable that has previously been opened to a file using the OPEN statement. If variable2 is not specified, the default file is assumed. expression1 should evaluate to a valid record key for the file. expression2 should evaluate to a positive integer. If the number is invalid or greater than the number of fields in the record, a NULL string will be assigned to variable1. If the number is 0 then the value returned in variable1 is controlled by the readv0 emulation setting. If a non-numeric argument is evaluated, a run time error will occur. If the SETTING clause is specified and the read fails, setvar will be set to one of the following values: Incremental File Errors
If ON ERROR is specified, the statements following the ON ERROR clause will be executed for any of the above Incremental File Errors except error 128.
NOTESIf you wish to set a lock on a record you should do so explicitly with the READU or READVU statement. EXAMPLESOPEN "Customers" ELSE ABORT 201, "Customers" |