SELECT

SELECT


secondary Index Level SEND
Syntax SELECT
SELECT variable {TO list.variable}
SELECT file.variable {TO list.variable}
Category BASIC
Type Statement
Description creates an "active" list of item-id's, allowing sequential access to each item in the file by use of the "readnext" statement.

Unlike the Access "select" or "sselect" verbs, the FlashBASIC "select" statement can NOT have selection criteria or perform a sort.  The FlashBASIC "select" passes through every item in the file in "hashed" order.

If the file.variable parameter is not specified, the default file.variable is used. When used with the "to" clause, the item list is assigned to the specified select variable.

If an external list is already active when the program is executed, or the program performs an "execute" of an Access "select", "sselect", "qselect", or "get-list", the active list is returned by the FlashBASIC "select", irrespective of the passed file.variable.
Options
See Also statements & functions EXECUTE TCL READNEXT file.variable default file variables active list secondary list
Example open 'customer' to customer.file else stop 201,'customer'
select customer.file
eof=0
loop
 readnext id else eof = 1
until eof do
 print id:" exists"
repeat

The "customer" file is opened and every item is selected.

select customer.file to customer.list
eof=0
loop
 readnext id from customer.list else eof=1
until eof do
 print id:" exists"
repeat

The customer.file is selected and assigned to the list.variable "customer.list".

string = '1001':char(254):'1002':char(254):'1003'
select string to list
eol=0
loop
readnext id from list else exit
print id:" exists"
repeat

The array.variable, "string", is treated as an active list by assigning it to the list variable, "list".

open 'md' to md.file else stop 201,'md'
execute 'select md with a1 = "d]"'
select md.file to md.list
loop
 readnext file.name from md.list then
   open file.name to temp.file then
     execute 'select ':file.name
     select temp.file to temp.list
     loop
       readnext temp.id else exit
       print temp.id:" in ":file.name:" exists"
     while 1 do repeat
   end
 end else exit
until 1 do repeat

This example demonstrates multiple active lists in the same program. This example first selects all local file pointers from the master dictionary and assigns them to the "md.list" list variable using "select". Each file name is used to select all items in the data section.
Warnings Another "select" clears the primary and secondary lists.

This form of "select" causes FlashBASIC to scan the file with each "readnext".

The "select" and "readnext" statements both consume an external list if one is available. As as result, "system(11)" always returns 0 (zero) after one of these statements. For example:

execute "select bp sampling 5"
print system(11)
select
print system(11)

This prints 5, then 0. The external list is consumed by a FlashBASIC variable and is then only available from FlashBASIC.

A select list variable may NOT be read or written by normal BASIC functions and statements.  Access must be purely through select and readnext.
Compatibility D3 7.0 AP R83
secondary Index Level SEND