Examples of Combining Compute Services and Data Transfer Services |
Purpose |
SAS/CONNECT is fully functional from within the macro facility. Both the UPLOAD and the DOWNLOAD procedures can update the macro variable SYSINFO and set it to a non-zero value if the procedure terminates because of errors.
You can also use the %SYSRPUT macro statement in the server session to send the value of the SYSINFO macro variable back to the client session. Thus, you can submit a job to the server and test whether a PROC UPLOAD or a PROC DOWNLOAD step successfully completed before beginning another step in either the client or server session.
Program |
This program includes a transaction file that is located on the client, which will be uploaded to a server in order to update a master file. You can test the results of the PROC UPLOAD step in the server session by checking the value of the SYSINFO macro variable.
The SYSINFO macro variable can be used to determine whether the transaction file was successfully uploaded. If successful, the master file is updated with the new information. If the upload was not successful, you receive a message that explains the problem.
You can use the %SYSRPUT macro statement to send the return code from the server session back to the client session. The client session can test the results of the upload and, if it is successful, use the DATASETS procedure to archive the transaction data set.
1 libname trans 'client-SAS-library'; libname backup 'client-SAS-library'; 2 rsubmit; 3 proc upload data=trans.current out=current; run; 4 %sysrput upload_rc=&sysinfo; %macro update_employee; 5 %if &sysinfo=0 %then %do; libname perm 'server-SAS-library'; data perm.employee; update perm.employee current; by employee_id; run; %end; 6 %else %put ERROR: UPLOAD of CURRENT failed. Master file was not updated.; %mend update_employee; 7 %update_employee; endrsubmit; 8 %macro check_upload; 9 %if &upload_rc=0 %then %do; 10 proc datasets lib=trans; copy out=backup; run; %end; %mend check_upload; 11 %check_upload;
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.