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

SELECT Syntax SELECT file.var [TO {list.num.expr | list.var.expr}] [ON ERROR statements] SELECT dyn.array [TO {list.num.expr | list.var.expr}] [ON ERROR statements] Description The UniBasic SELECT command creates an active select list of all record IDs in a file. Records appear in the list in the order in which they are stored in the file. You can access the select list with a READNEXT statement. The UniBasic SELECT command differs from EXECUTE "SELECT ...", which executes the UniQuery SELECT command. The UniBasic SELECT command immediately makes available to READNEXT one group of IDs at a time. The program does not have to wait for the entire ID list to be constructed. If changes occur in a group that has not been selected yet, those changes are reflected in the select list that is being read by the program. If an ID is deleted before the group is selected by the UniBasic program, that ID does not appear in the list. Record IDs are truncated at 96 characters when they are copied into the select list. When using the UniQuery SELECT command, SYSTEM(11) returns the number of items remaining in the list. With the UniBasic SELECT command, SYSTEM(11) returns the number of items remaining in the group. Note: You can specify named or numbered lists (using list.num.expr or list.var.expr) in BASICTYPEs R and U. Only named lists (list.var.expr) are supported in BASICTYPEs M and P. 1-702 UniBasic Commands Reference

Parameters The following table describes each parameter of the syntax. Parameter Description file.var Specifies a file variable from which to read record IDs. 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. dyn.array Specifies a dynamic array from which to select a list of attributes. TO list.num.expr Supported in BASICTYPEs R and U only. Specifies a numbered select list, 0–9, to contain record IDs. If you do not specify a list, SELECT creates list 0. TO list.var.expr Supported in all BASICTYPEs. Specifies a named select list to contain record IDs. Initialize list.var.expr with a statement like list.name = '' before using it in the SELECT statement to avoid a compiler warning for an uninitialized variable. ON ERROR statements Specifies statements to execute if the SELECT 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. SELECT Parameters SELECT 1-703

SELECT<br />

Syntax<br />

SELECT file.var [TO {list.num.expr | list.var.expr}] [ON ERROR statements]<br />

SELECT dyn.array [TO {list.num.expr | list.var.expr}] [ON ERROR statements]<br />

Description<br />

The <strong>UniBasic</strong> SELECT command creates an active select list of all record IDs in a<br />

file. Records appear in the list in the order in which they are stored in the file.<br />

You can access the select list with a READNEXT statement.<br />

The <strong>UniBasic</strong> SELECT command differs from EXECUTE "SELECT ...", which<br />

executes the UniQuery SELECT command. The <strong>UniBasic</strong> SELECT command<br />

immediately makes available to READNEXT one group of IDs at a time. The<br />

program does not have to wait for the entire ID list to be constructed.<br />

If changes occur in a group that has not been selected yet, those changes are reflected<br />

in the select list that is being read by the program. If an ID is deleted before the group<br />

is selected by the <strong>UniBasic</strong> program, that ID does not appear in the list.<br />

Record IDs are truncated at 96 characters when they are copied into the select list.<br />

When using the UniQuery SELECT command, SYSTEM(11) returns the number of<br />

items remaining in the list. With the <strong>UniBasic</strong> SELECT command, SYSTEM(11)<br />

returns the number of items remaining in the group.<br />

Note: You can specify named or numbered lists (using list.num.expr or list.var.expr)<br />

in BASICTYPEs R and U. Only named lists (list.var.expr) are supported in<br />

BASICTYPEs M and P.<br />

1-702 <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!