Previous Page | Next Page

Example of Combining RLS and Data Transfer Services (DTS)

Example -- RLS and UPLOAD/DOWNLOAD Combined: Distribution of Reports over a Network


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;

[1] Declares the distribution macro definition.

[2] Initializes the list of remote franchise offices (franchise_city ) and their node names (franchise_host ) to be used as the REMOTE= value.

[3] Scans to the next office and node name to be processed.

[4] Specifies the remote office NODENAME as the REMOTE= value and sign on to the remote franchise.

[5] Allocates a z/OS file that will contain generated UPLOAD statements.

[6] Remotely submits a fileref to define the PC library to which reports will be uploaded.

[7] Connects to a server to access the library that contains the report-selection data set.

[8] Executes the DATA step to evaluate report-selection data (RPT.PREPORT) and creates UPLOAD statements to transfer reports (XFERRPT).

[9] If the selection criterion is YES, creates the appropriate PROC UPLOAD statement for the specified report.

[10] Includes the generated SAS job in the client session for execution.

[11] Invokes the macro.

Previous Page | Next Page | Top of Page