Examples Using Remote Library Services (RLS) |
Purpose |
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 server session before any data is transferred. As a result, only the observations that meet the criteria are moved to the client session.
This example is a good use of RLS because (as in the previous example) it involves transaction-type processing and enables the client 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 client session and compared against the specified criteria. The response time might be poor. These alternative programming choices emphasize the importance of being aware of the amount of data that the client session requests and minimizing this amount when using RLS.
Program |
signon apex; libname master REMOTE "hq.prod.data" server=apex; 1 rdsid = open("master.reserv", 'u'); 2 wherecls="resnum=" || "'" || resnum || "'"; rc = where(rdsid, wherecls); call set(rdsid); rc = fetchobs(rdsid, 1);
Builds and applies the WHERE clause to accelerate retrieval. |
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.