Chapter Contents


SAS/CONNECT User's Guide

Example 4. RLS: An SCL Program That Uses the WHERE Statement


This example is an excerpt from an SCL program that uses RLS to query a remote reservation database. Reservations are selected based on the value that is stored in the variable RESNUM. The use of the WHERE clause in this example is important because the WHERE clause is applied in the remote session before any data is transferred. As a result, only the observations that meet the criteria are moved to the local session.

This example is a good use of RLS because (as in the previous example) it involves transaction-type processing and enables the local GUI to be used for data entry on the selected observations in the database.

However, if you were to use the SCL LOCATEC function, every observation would be transferred to the local session and compared against the specified criteria. The response time in this case would be poor, at best. These alternative programming choices emphasize the importance of being aware of the amount of data that local processing is requesting and minimizing this amount when using RLS.


signon os390;

libname master REMOTE "" 

rdsid = open("master.reserv", 'u');

wherecls="resnum=" || "'" || resnum || "'";
rc = where(rdsid, wherecls);
call set(rdsid);
rc = fetchobs(rdsid, 1);
[1] Open the remote Headquarters database.
[2] Build and apply the WHERE clause to speed up retrieval.

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.