UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
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
- Page 598 and 599: Parameters The following table desc
- Page 600 and 601: OSREAD Syntax OSREAD var FROM filen
- Page 602 and 603: OSWRITE Syntax OSWRITE expr {ON | T
- Page 604 and 605: PAGE Syntax PAGE [ON num.expr] [exp
- Page 606 and 607: PAUSE Syntax PAUSE [wait_time] Desc
- Page 608 and 609: PCPERFORM Syntax PCPERFORM str.expr
- Page 610 and 611: PERFORM PERFORM is a synonym for th
- Page 612 and 613: Related Command UniData FLOAT.PRECI
- Page 614 and 615: Example The following example illus
- Page 616 and 617: Parameters The following table desc
- Page 618 and 619: PRINTER Syntax PRINTER {ON | OFF} D
- Page 620 and 621: PRINTERR Syntax PRINTERR expr [FROM
- Page 622 and 623: Code Description Examples In the fo
- Page 624 and 625: PROCREAD Syntax PROCREAD var {THEN
- Page 626 and 627: The following globally cataloged pr
- Page 628 and 629: PROCWRITE Syntax PROCWRITE expr Des
- Page 630 and 631: PROMPT Syntax PROMPT str.expr Descr
- Page 632 and 633: protocolLogging Syntax protocolLogg
- Page 634 and 635: PWR Syntax PWR(num.expr1, num.expr2
- Page 636 and 637: Related Command UniBasic SQUOTE 1-5
- Page 638 and 639: READ Syntax READ dyn.array.var FROM
- Page 640 and 641: Example In the following example, t
- Page 642 and 643: Parameters The following table desc
- Page 644 and 645: READBCKL Syntax READBCKL dyn.array.
- Page 646 and 647: STATUS Function Return Values After
- Page 650 and 651: STATUS Function Return Values After
- Page 652 and 653: READFWD Syntax READFWD dyn.array.va
- Page 654 and 655: Example In the following example, t
- Page 656 and 657: Parameters The following table desc
- Page 658 and 659: Related Commands UniBasic READBCK,
- Page 660 and 661: Parameters The following table desc
- Page 662 and 663: Related Commands UniBasic READBCK,
- Page 664 and 665: Parameters The following table desc
- Page 666 and 667: UniData DEFAULT.LOCKED.ACTION - For
- Page 668 and 669: Parameters The following table desc
- Page 670 and 671: READNEXT Syntax READNEXT id.var [,
- Page 672 and 673: Parameter Description Examples In t
- Page 674 and 675: READNEXTTUPLE Syntax READNEXTTUPLE
- Page 676 and 677: Example In the following example, t
- Page 678 and 679: READSEQ Syntax READSEQ var FROM seq
- Page 680 and 681: eadSocket Syntax readSocket(socket_
- Page 682 and 683: READT Syntax READT [UNIT (mu.expr)]
- Page 684 and 685: Example In the following example, t
- Page 686 and 687: Parameters The following table desc
- Page 688 and 689: Related Commands UniBasic CLOSE, DE
- Page 690 and 691: Parameter Description Examples In t
- Page 692 and 693: READVL Syntax READVL var FROM [file
- Page 694 and 695: Example In the following example, R
- Page 696 and 697: Parameters The following table desc
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>