Example of Combining RLS and Data Transfer Services (DTS) |
Purpose |
This SCL program fragment enables the distribution of production reports from a company's headquarters location to each of its franchise offices, based on the information that is contained in the control data set that is maintained by each of the franchise offices. This application was implemented by using the macro facility to enable the mainframe to connect with each of the franchise workstations, and to transfer a set of reports to the franchise offices based on selection criteria.
Program |
/************************************/ /* Name: DISTREPORT.SCL */ /* */ /* This program distributes reports */ /* to the franchise offices. */ /************************************/ length rc 8; INIT: submit continue; /************************************/ /* set up distribution macro */ /************************************/ 1 %macro distribution; 2 %let franchise_city= Atlanta NYC LA Dallas Chicago; %let franchise_host= tsoatl unixnyc unixla wntdal cmshq; 3 %let j=1; %do %while(%scan(&franchise_city,&j) ne ); %let nextfran=%scan(&franchise_city,&j); %let nextrem=%scan(&franchise_host,&j); %let j=%eval(&j+1); 4 options remote=&nextrem comamid=communication-access-method; filename rlink 'script-file-name'; signon; 5 x "alloc fi(xferrpt) da('sasinfo.sugi18.xferrpt') shr"; 6 rsubmit; filename frptlib "d:\counter\reports\prod"; endrsubmit; /************************************/ /* use SAS/CONNECT server */ /************************************/ 7 libname rpt "d:\counter\reports" server=&nextrem; 8 data _null_; set rpt.preport end=finish; file xferrpt; if _n_ =1 then put "rsubmit;"; /*********************************/ /* transfer reports */ /* named by variable name in */ /* reports data set */ /*********************************/ 9 if (copy="Y") then do; put "proc upload infile= 'sasinfo.sugi18."name"'"; put "outfile=frptlib("name") status=no;run;"; end; if finish then put "endrsubmit;"; run; /************************************/ /* upload reports that you want */ /************************************/ 10 %include xferrpt; signoff; %end; %mend; /************************************/ /* invoke macro to distribute */ /* reports */ /************************************/ 11 %distribution; endsubmit; _status_='H'; return; MAIN: return; TERM: return;
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.