UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
Parameter Description Examples In the following example, the program segment reads 10 IDs from select list 1, and then reads the records associated with those IDs. If a record ID is not found in the default system file, the program displays the message NOT FOUND. 1-630 UniBasic Commands Reference ON ERROR statements Specifies statements to execute if the READNEXT 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 user enters the debugger. 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 does not exist. END is required to terminate multiline ELSE statements. READNEXT Parameters (continued) FOR I = 1 TO 10 READNEXT ID FROM 1 ELSE SHORT.LIST = 1 THEN READU REC FROM CUST,ID ELSE PRINT "NOT FOUND" END NEXT I
In the next example, the program selects all Canadian clients, and then executes READNEXT to read and display the records for the first 22: EXECUTE 'SELECT CLIENTS WITH COUNTRY = "Canada"' EXECUTE "SAVE.LIST 'canadians'" OPEN 'CLIENTS' TO CLIENT.FILE ELSE ABORT GETLIST 'canadians' SETTING LIST.CNT ELSE PRINT CLIENT:" SAVELISTS ID ‘canadians’ CANNOT BE FOUND";STOP PRINT @(-1) FOR I = 1 TO 22 READNEXT ID ELSE EXIT READ REC FROM CLIENT.FILE, ID THEN PRINT @(5,I):REC:@(20,I):REC END ELSE PRINT "CANNOT FIND RECORD":ID END NEXT I CLEARSELECT END Related Commands UniBasic DELETELIST, FORMLIST, GETLIST, READLIST, SELECT, SELECTINDEX, SELECTINFO, WRITELIST UniQuery DELETE.LIST, GET.LIST, SAVE.LIST, SELECT, SSELECT – For information, see the UniQuery Commands Reference. UniData SQL SELECT – For information, see the UniData SQL Commands Reference. READNEXT 1-631
- 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 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 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
- 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
Parameter Description<br />
Examples<br />
In the following example, the program segment reads 10 IDs from select list 1, and<br />
then reads the records associated with those IDs. If a record ID is not found in the<br />
default system file, the program displays the message NOT FOUND.<br />
1-630 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />
ON ERROR statements Specifies statements to execute if the READNEXT statement<br />
fails with a fatal error because the file is not open, an I/O error<br />
occurs, or UniData cannot find the file.<br />
If you do not specify the ON ERROR clause and a fatal error<br />
occurs, the user enters the debugger.<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 does<br />
not exist. END is required to terminate multiline ELSE<br />
statements.<br />
READNEXT Parameters (continued)<br />
FOR I = 1 TO 10<br />
READNEXT ID FROM 1 ELSE SHORT.LIST = 1 THEN<br />
READU REC FROM CUST,ID ELSE PRINT "NOT FOUND"<br />
END<br />
NEXT I