Example of Combining RLS and Data Transfer Services (DTS) |
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.
/************************************/
/* 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;
|
Declares the distribution macro definition. |
|
Initializes the list of remote franchise offices
(franchise_city
) and their node names (franchise_host
) to be used
as the REMOTE= value. |
|
Scans to the next office and node name to
be processed. |
|
Specifies the remote office NODENAME as the
REMOTE= value and sign on to the remote franchise. |
|
Allocates a z/OS file that will contain generated
UPLOAD statements. |
|
Remotely submits a fileref to define the PC
library to which reports will be uploaded. |
|
Connects to a server to access the library
that contains the report-selection data set. |
|
Executes the DATA step to evaluate report-selection
data (RPT.PREPORT) and creates UPLOAD statements to transfer reports (XFERRPT). |
|
If the selection criterion is YES, creates
the appropriate PROC UPLOAD statement for the specified report. |
|
Includes the generated SAS job in the client
session for execution. |
|
Invokes the
macro. |
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.