Using the SELECT Verb with the Data Server

To ensure optimum performance when accessing remote files via the SELECT verb, specify the full path name of the remote file, complete with the name of the network host. It is particularly important to include the network host name in the FROM clause of a SELECT statement due to the large number of I/O operations involved with selecting and sorting. This enables the remote system (with the PRO/5 Data Server) to perform all of the necessary I/O operations locally and return only the requested data over the network connection, which results in reduced network traffic and improved performance.

Relying on a PREFIX to locate the remote file causes the SELECT to be performed locally, which places heavier demands on the network and increases response time. See the following examples:

Preferred Example

Discouraged Example

SELECT (1) REC$ FROM "/<server>remotefile"

SELECT (1) REC$ FROM "remotefile"

Observe the following guidelines for using the SELECT verb with the Data Server:

On multi-tasking systems, PRO/5 allocates a background user slot for each active SELECT. See User Limits and User Numbers in the PRO/5 Installation and Configuration Guide.

Under the UNIX operating system, the SELECT verb requires two semaphores and one shared memory segment for each active SELECT.

In the single-user MS-DOS version of PRO/5, the SELECT execution is deferred until a READ command is executed on the channel. For SELECT commands that include SORTBY parameters, the entire file must be sorted before the first record can be read. If unusual errors occur on the READ, the error may refer to the actual SELECT usage.

The TMPDIR environment variable should be set in the shell of the process that is performing the SELECT. If the PRO/5 client is performing the SELECT, TMPDIR should be set in its shell. If the SELECT is to be performed via the Data Server, TMPDIR should be set before the Data Server is invoked. If the Data Server is invoked via a startup script, the script should set TMPDIR before invoking the Data Server.


In the following example, records in the master file that have a balance field greater than the limit field are selected from the file and sorted in order of increasing balance. The MODE="BLOCK=200" sets up a 200 record buffer between the SELECT process and the main PRO/5 process. The READ RECORD in statement 2010 reads the sorted records from the buffer, returning the fields as specified in the SELECT statement, via the SELREC$ template.

The WHERE expression parentheses in line 1010 are included for readability only and are not required.

1000 DIM REC$:"CUST_NUM:C(7),NAME:C(35),ADDRESS1:(35)

2005 DIM SELREC$:FIN$(65)