basic.select

Statement/BASIC Program, Releases: AP and R83

Creates internal active list.

Syntax

select select variable {to list.variable} select file.variable {to list.variable}

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.

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.

See Also

Command Name Type Description
basic.statements Definition Definition of statements and functions.
basic.execute Statement Performs TCL command expression.
basic.tcl Statement Performs TCL command expression.
basic.readnext Statement Retrieves the next item-id from an active list.
basic.file.variable Definition Defines file location from previous 'open' statement.
basic.default.files Definition used by any file-access Pick/BASIC statement when a specific file variable is not specified.
active.list Definition A list of strings delimited by attribute marks created by one of the list-generating processes.
secondary.list Definition A list of item-id's generated by one of the list-generating processes while an active list is present.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.