![]() ![]() |
|
READThe READ statement allows a program to read a record from a previously opened file into a variable.
COMMAND SYNTAXREAD variable1 FROM { variable2,} expression {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 then the default file is assumed. The expression should evaluate to a valid record key for the file. 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 statement. An attempt to access a 'null' item-id in a directory will take the ELSE clause, i.e. treated as 'item does not exist'.
EXAMPLE 1
EXAMPLE 2
|