Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

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


Purpose

The following SCL program fragment enables distribution of production reports from a company's headquarters location to each of its franchise offices based on the information contained in the control data set maintained by each of the franchise offices. This application was implemented by using the macro facility to enable the mainframe to initiate a conversation with each of the franchise workstations and transfer a set of reports to the franchise 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);
      %end;

[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 desired 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 desired reports           */
      /************************************/
[10] %include xferrpt;

   signoff;
   %end;

   %end;
   %mend;

      /************************************/
      /* invoke macro to distribute       */
      /* reports                          */
      /************************************/
[11] %distribution;
  endsubmit;

   _status_='H';

   return;

   MAIN:
      return;

   TERM:
      return;
[1] Begin the distribution macro definition.
[2] Initialize the list of remote franchise offices ( franchise_city) and their node names ( franchise_host) to be used as the REMOTE= value.
[3] Scan to the next office and node name to be processed.
[4] Specify the remote office nodename as the REMOTE= value and sign on to the remote franchise.
[5] Allocate an OS/390 file that will contain generated UPLOAD statements.
[6] Remote submit a fileref to define the PC library to which reports will be uploaded.
[7] Connect to single-user server to access the library that contains the report-selection data set.
[8] Execute the DATA step to evaluate report-selection data (RPT.PREPORT) and create UPLOAD statements to transfer reports (XFERRPT).
[9] If the selection criterion is yes, create the appropriate PROC UPLOAD statement for the particular report.
[10] Include the generated SAS job in the local OS/390 SAS session for execution.
[11] Invoke the macro.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.