UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

READBCKU Syntax READBCKU dyn.array.var [FROM file.var] [ON ERROR statements] [LOCKED statements] {THEN statements [END] | ELSE statements [END]} READBCKU dyn.array.var [FROM file.var] [LOCKED statements] [ON ERROR statements] {THEN statements [END] | ELSE statements [END]} Description The first READBCKU command retrieves the alternate key set by SETINDEX, and then each subsequent READBCKU retrieves the previous alternate key value in the index. The corresponding record is read into a dynamic array, and the record ID is assigned to the @ID variable. READBCKU checks for locks. If the record is available, it sets an exclusive (U) lock before reading the record. Note: UniBasic locks are advisory only. For more information, see Developing UniBasic Applications. Using this command in a loop, a UniBasic program retrieves records in descending order based on an indexed attribute. Before executing READBCKU, you must set the alternate key value with the SETINDEX command. The SETINDEX parameters BUFFER.KEYS and VALIDATE.KEY determine, respectively, whether the buffering mechanism is used and whether keys are validated when READBCKU executes. For details, see SETINDEX. READBCKU sets the STATUS function return value to 10 if UniBasic detects a duplicate alternate index key value and you have executed the ECL command DUP.STATUS ON during the current session. 1-606 UniBasic Commands Reference

Parameters The following table describes each parameter of the syntax. Parameter Description dyn.array.var Specifies a target dynamic array to receive the data read. FROM file.var Specifies a file variable from which to read the record. If you do not specify a file.var, UniData reads from the default file. If no default file is open, a fatal error occurs. The default file is one for which no file variable is assigned in the OPEN statement. ON ERROR statements Specifies statements to execute if the READBCKU statement fails with a fatal error because the file is not open, an I/O error occurs, or UniData cannot find the file. If you do not specify the ON ERROR clause and a fatal error occurs, the program terminates. LOCKED statements Specifies statements to execute if the record is already locked. If you do not specify the LOCKED clause, and if the record is locked, UniData waits until the record is available. Use the ECL command DEFAULT.LOCKED.ACTION BELL to make the terminal beep while you wait for UniData to unlock the record. THEN statements END THEN executes if the read is not successful. END is required to terminate multiline THEN statements. ELSE statements END ELSE executes if the read is not successful, the current alternate key value is not set by the SETINDEX command, or UniData cannot locate the current alternate key value (for example, when UniData reaches the end of the alternate index). END is required to terminate multiline ELSE statements. READBCKU Parameters READBCKU 1-607

READBCKU<br />

Syntax<br />

READBCKU dyn.array.var [FROM file.var] [ON ERROR statements]<br />

[LOCKED statements] {THEN statements [END] | ELSE statements [END]}<br />

READBCKU dyn.array.var [FROM file.var] [LOCKED statements]<br />

[ON ERROR statements] {THEN statements [END] | ELSE statements [END]}<br />

Description<br />

The first READBCKU command retrieves the alternate key set by SETINDEX, and<br />

then each subsequent READBCKU retrieves the previous alternate key value in the<br />

index. The corresponding record is read into a dynamic array, and the record ID is<br />

assigned to the @ID variable. READBCKU checks for locks. If the record is<br />

available, it sets an exclusive (U) lock before reading the record.<br />

Note: <strong>UniBasic</strong> locks are advisory only. For more information, see Developing<br />

<strong>UniBasic</strong> Applications.<br />

Using this command in a loop, a <strong>UniBasic</strong> program retrieves records in descending<br />

order based on an indexed attribute.<br />

Before executing READBCKU, you must set the alternate key value with the<br />

SETINDEX command. The SETINDEX parameters BUFFER.KEYS and<br />

VALIDATE.KEY determine, respectively, whether the buffering mechanism is used<br />

and whether keys are validated when READBCKU executes. For details, see<br />

SETINDEX.<br />

READBCKU sets the STATUS function return value to 10 if <strong>UniBasic</strong> detects a<br />

duplicate alternate index key value and you have executed the ECL command<br />

DUP.STATUS ON during the current session.<br />

1-606 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!