UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
Parameters The following table describes each parameter of the syntax. Parameter Description 1-644 UniBasic Commands Reference dyn.array.var Specifies a dynamic array to contain the record. FROM file.var, Specifies the 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. record.ID.expr Specifies the record ID to use to retrieve the record. ON ERROR statements Specifies statements to execute if the READU 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 locked by another user. If you do not specify a LOCKED clause, the program waits until the lock on the record is released. 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 successful. END is required to terminate multiline THEN statements. ELSE statements END ELSE executes if the read is not successful or the record (or ID) does not exist. END is required to terminate multiline ELSE statements. READU Parameters
STATUS Function Return Values After you execute READU, the STATUS function returns one of the values described in the following table. Examples Value Description 0 Successful read. 1 UniData was unable to read the record. n The record is locked. The user number of the user who locked the file is returned in n. STATUS Function Return Values The following program segment is taken from the sample program in Appendix A, “Sample Programs,” in Developing UniBasic Applications. READU checks for locks. If the record is available, it sets an exclusive lock and reads the record into ORDER.REC. DISPLAY_DATA: * Display the current information in the desired record. This is * determined by the number the user entered (ORDER_NUMBER). READU ORDER.REC FROM ORDERS_FILE,ORDER_NUMBER THEN * Read with a lock so that no one else can modify it at the same time. RECORD_FOUND = 1 The record remains locked until the following program executes, which releases locks: WRITE ORDER.REC ON ORDERS_FILE,ORDER_NUMBER In the following example, the program segment assigns the record, read from the default file, to the variable INFO, and sets an exclusive lock on that record. UniData prints “Record locked” if the record is locked by another program, or prints “File not found” if the record does not exist. If the default file is not found, the program ends. READU INFO FROM "IDENT" LOCKED PRINT "Record locked" ELSE PRINT "Record not found" READU 1-645
- 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 648 and 649: READBCKU Syntax READBCKU dyn.array.
- 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 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
- Page 698 and 699: READXBCK Syntax READXBCK dyn.array.
- Page 700 and 701: READXFWD Syntax READXFWD dyn.array.
- Page 702 and 703: ReadXMLData Syntax ReadXMLData(xml_
- Page 704 and 705: RECORDLOCKED Syntax RECORDLOCKED (f
- Page 706 and 707: STATUS Function Return Values After
- Page 708 and 709: Parameter Description Examples In t
- Page 710 and 711: RECORDLOCKU Syntax RECORDLOCKU [fil
- Page 712 and 713: RELEASE Syntax RELEASE [file.var [,
- Page 714 and 715: ReleaseXML Syntax ReleaseXML(XMLhan
- Page 716 and 717: Example In the following example, c
- Page 718 and 719: Parameter Description The SETTING c
- Page 720 and 721: In some implementations, the values
- Page 722 and 723: REMOVE Syntax REMOVE(dyn.array.var,
- Page 724 and 725: REPLACE Syntax REPLACE(dyn.array.ex
- Page 726 and 727: In the next example, the program se
- Page 728 and 729: RESIZET Syntax RESIZET [UNIT(mu.exp
- Page 730 and 731: RETURN Syntax RETURN [TO label[:]]
- Page 732 and 733: Examples In the following example,
- Page 734 and 735: Example In the following example, t
Parameters<br />
The following table describes each parameter of the syntax.<br />
Parameter Description<br />
1-644 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />
dyn.array.var Specifies a dynamic array to contain the record.<br />
FROM file.var, Specifies the file variable from which to read the record.<br />
If you do not specify a file.var, UniData reads from the default<br />
file. If no default file is open, a fatal error occurs.<br />
The default file is one for which no file variable is assigned in<br />
the OPEN statement.<br />
record.ID.expr Specifies the record ID to use to retrieve the record.<br />
ON ERROR statements Specifies statements to execute if the READU statement fails<br />
with a fatal error because the file is not open, an I/O error occurs,<br />
or UniData cannot find the file.<br />
If you do not specify the ON ERROR clause and a fatal error<br />
occurs, the program terminates.<br />
LOCKED statements Specifies statements to execute if the record is locked by another<br />
user. If you do not specify a LOCKED clause, the program waits<br />
until the lock on the record is released.<br />
Use the ECL command DEFAULT.LOCKED.ACTION BELL<br />
to make the terminal beep while you wait for UniData to unlock<br />
the record.<br />
THEN statements END THEN executes if the read is successful. END is required to<br />
terminate multiline THEN statements.<br />
ELSE statements END ELSE executes if the read is not successful or the record (or ID)<br />
does not exist. END is required to terminate multiline ELSE<br />
statements.<br />
READU Parameters