UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
Examples The following program segment places in select list 1 all record IDs in the CLIENTS file, and then prints the ID of the first record: 1-704 UniBasic Commands Reference OPEN 'CLIENTS' TO CLIENT ON ERROR PRINT "File open error." THEN PRINT "OPEN" SELECT CLIENT TO 1 READNEXT var FROM 1 ON ERROR PRINT "Error in READNEXT." THEN PRINT var END ELSE PRINT "Record not found." END The following sample program creates a select list that is named rather than numbered. This program is compiled in BASICTYPE P, but compiles and runs in all BASICTYPEs. $BASICTYPE "P" list = '' OPEN 'INVENTORY' TO INV_FILE ELSE PRINT "OPEN error" SELECT INV_FILE TO list FOR X = 1 TO 10 READNEXT ID FROM list ELSE PRINT "No more IDs in list" END READU REC FROM INV_FILE,ID THEN PRINT "Record ":X:" is ":REC:" ":REC END ELSE PRINT "Record not found." END NEXT X END Here is the output for this program: Record 1 is 10105 Memory Record 2 is 10076 Telephone Record 3 is 10020 Adapter Record 4 is 10086 Modem Record 5 is 10092 Adapter Record 6 is 10073 Monitor Record 7 is 10041 Computer Record 8 is 10071 Computer Record 9 is 10103 Telephone Record 10 is 10101 Computer In the following example, the program statement creates a list of all record IDs in the INVENTORY file in active select list 0: SELECT INVENTORY
In the next example, the program segment first creates a list of all IDs in the ORDERS file and assigns the ID list to list 1. It then uses the READNEXT command to read the IDs from the list sequentially, executing a subroutine, PROCESS.ORDERS, each time. SELECT ORDERS TO 1 LOOP READNEXT ORDER.ID FROM 1 ELSE TAPE.ID = " " WHILE ORDER.ID GOSUB PROCESS.ORDERS REPEAT Related Commands UniBasic DELETELIST, FORMLIST, READLIST, 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. SELECT 1-705
- 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
- Page 736 and 737: RNDSEED Syntax RNDSEED expr Descrip
- Page 738 and 739: SADD Syntax SADD(x, y) Description
- Page 740 and 741: The following table describes the s
- Page 742 and 743: Example In the following example, t
- Page 744 and 745: SELECT Syntax SELECT file.var [TO {
- Page 748 and 749: SELECTINDEX Syntax SELECTINDEX inde
- Page 750 and 751: Related Commands UniBasic DELETELIS
- Page 752 and 753: Related Commands UniBasic DELETELIS
- Page 754 and 755: Note: SEND with the X option suppre
- Page 756 and 757: SEQS Syntax SEQS("char.expr") Descr
- Page 758 and 759: The following table describes the s
- Page 760 and 761: Parameters The following table desc
- Page 762 and 763: The following table describes the s
- Page 764 and 765: setHTTPDefault Syntax setHTTPDefaul
- Page 766 and 767: The following table describes the s
- Page 768 and 769: Parameters The following table desc
- Page 770 and 771: Examples In the following example,
- Page 772 and 773: setPrivateKey Syntax setPrivateKey(
- Page 774 and 775: setRandomSeed Syntax setRandomSeed(
- Page 776 and 777: setRequestHeader Syntax setRequestH
- Page 778 and 779: setSocketOptions Syntax setSocketOp
- Page 780 and 781: showSecurityContext Syntax showSecu
- Page 782 and 783: SIGNATURE Syntax SIGNATURE(algorith
- Page 784 and 785: Return Code Status 1-742 UniBasic C
- Page 786 and 787: SLEEP Syntax SLEEP [hh:mm[:ss]] [se
- Page 788 and 789: SMUL Syntax SMUL(x, y) Description
- Page 790 and 791: Return Codes The return code indica
- Page 792 and 793: The following table describes each
- Page 794 and 795: SOAPGetDefault Syntax SOAPGetDefaul
Examples<br />
The following program segment places in select list 1 all record IDs in the CLIENTS<br />
file, and then prints the ID of the first record:<br />
1-704 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />
OPEN 'CLIENTS' TO CLIENT ON ERROR PRINT "File open error." THEN<br />
PRINT "OPEN"<br />
SELECT CLIENT TO 1<br />
READNEXT var FROM 1 ON ERROR PRINT "Error in READNEXT." THEN<br />
PRINT var<br />
END ELSE<br />
PRINT "Record not found."<br />
END<br />
The following sample program creates a select list that is named rather than<br />
numbered. This program is compiled in BASICTYPE P, but compiles and runs in all<br />
BASICTYPEs.<br />
$BASICTYPE "P"<br />
list = ''<br />
OPEN 'INVENTORY' TO INV_FILE ELSE PRINT "OPEN error"<br />
SELECT INV_FILE TO list<br />
FOR X = 1 TO 10<br />
READNEXT ID FROM list ELSE<br />
PRINT "No more IDs in list"<br />
END<br />
READU REC FROM INV_FILE,ID THEN<br />
PRINT "Record ":X:" is ":REC:" ":REC<br />
END ELSE<br />
PRINT "Record not found."<br />
END<br />
NEXT X<br />
END<br />
Here is the output for this program:<br />
Record 1 is 10105 Memory<br />
Record 2 is 10076 Telephone<br />
Record 3 is 10020 Adapter<br />
Record 4 is 10086 Modem<br />
Record 5 is 10092 Adapter<br />
Record 6 is 10073 Monitor<br />
Record 7 is 10041 Computer<br />
Record 8 is 10071 Computer<br />
Record 9 is 10103 Telephone<br />
Record 10 is 10101 Computer<br />
In the following example, the program statement creates a list of all record IDs in the<br />
INVENTORY file in active select list 0:<br />
SELECT INVENTORY