basic.select Statement/BASIC Program

basic.select

Command basic.select Statement/BASIC Program
Applicable release versions: AP, R83
Category BASIC Program (486)
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 Pick/BASIC "select" statement can NOT have selection criteria or perform a sort. The Pick/BASIC "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 Pick/BASIC "select", irrespective of the passed file.variable.
Syntax select
select variable {to list.variable}
select file.variable {to list.variable}
Options
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.
Purpose
Related basic.statements
basic.execute
basic.tcl
basic.readnext
basic.file.variable
basic.default.files
active.list
secondary.list