FILESRV Program

Prev | Next | Contents


FILESRV Example

This document is supplemental information for the FILESRV program. The purpose of this supplement is to demonstrate the steps necessary to serve a new file type and to give users the authorization to view the new type in a specified directory.

  1. Create a libname test 'XXX', where XXX is specific to the operating system. This directory must have write privileges.

  2. Update TEST.FSAUTH.sas7bdat in the libname created in step 1. This will give users authorization to view files designated in the FILETYPE statement and in the directory defined in the PATH statement.

    Run the following code:

       proc sql;
       create table test.fsauth as select * from sashelp.fsauth; 
    
       insert into test.fsauth
       set
          filetype='*',
    	     /* Specify e for an external file and c for a catalog entry. */
             /* This value is not case-sensitive. */
    
          path='`"*"'
    	     /* This value is case-sensitive only if the host operating environment */   
             /*honors case-sensitive  filenames.  See "Example authorization data set" */
             /*at http://support.sas.com/rnd/web/intrnet/filesrv/examds.html */     
          ;
       quit;
       ods listing close;
    
       Title1 'Display of TEST.FSAUTH => after inserts';
       ods html rs=none body=_webout(dynamic);
       proc print data=test.fsauth;
       run;
    
       ods html close;
       ods listing;
    

    For an example of an authorization data set, see Example Data Sets.

  3. Update TEST.FSHEAD.sas7bdat in the libname created in step 1. This example illustrates how to add a new file extension to be served using the FILESRV utility. In this case, serving a SAS data set will be the result of adding an ext='sas7bcat' and indicating that the file is external. When the file is served, the default name will be temp.sas7bdat.

    Run the following code:

       proc sql; 
       create table test.fshead as select * from sashelp.fshead; 
    
       insert into test.fshead
       set
          filetype='e',
          datatype='b' ,
          ext='sas7bdat',
          header='Content-type: application/x-sas-data'
    
       set
          filetype='e',
          datatype='b' ,
          ext='sas7bdat',
          header='Content-disposition: attachment; filename=temp.sas7bdat';
    
       select * from test.fshead where ext='sas7bdat';
       quit;
    
       Title1 'Display of TEST.FSHEAD => after inserts';
       ods html rs=none body=_webout(dynamic);
       proc print data=test.fshead;
       run;
    
       ods html close;
       ods listing;
    
  4. If the application server is running, stop the server at this point. You need to enable the newly updated files, TEST.FSAUTH.sas7bdat and TEST.FSHEAD.sas7bdat, in order for the changes to take effect. You should restart the application server. You can also modify the SAS command that is starting the Service so that it uses the -insert SASHELP option. In this case, the option to be used is -insert SASHELP directory path. The directory path is the location where TEST.FSAUTH.sas7bdat and TEST. FSHEAD.sas7bdat reside. This will cause the two files, TEST.FSAUTH.sas7bdat and TEST.FSHEAD.sas7bdat, to take effect.

    For example, a pool service definition, might include the SasCommand, as follows:

       SasCommand   "\"G:\\sas\\v82\\sas.exe\" +
          \"D:\\WINNT\\Profiles\\xxxxx\\Personal\\My SAS Files\\V82\\IntrNet\\pool1\\appstart.sas\" +
          -insert SASHELP 'g:\\sas\\sasauth' +
          -rsasuser -nosyntaxcheck -noterminal -nolog 
    

    The path, g:\\sas\\sasauth, is searched for FSAUTH and FSHEAD.

    For additional information about SasCommand, see Configuration File Directives in the Application Dispatcher documentation.

    Depending on how application servers are started at a site and where the updated FSAUTH.sas7bdat and FSHEAD.sas7bdat reside, you might have to modify the SAS command. For example, if your site uses UNIX, you might need to modify the actual command that is being used to start the service, which is usually the start.pl script. You can use the same technique as in the previous example for a UNIX Application Dispatcher by using the following in the SasCommand:

       -insert SASHELP '/usr/tmp/sasauth'
    
  5. Run the FILESRV utility using either of the following:

    The following is an example of invoking an external file of type .sas7bdat from an address line:

       http://yourserver/cgi-bin/broker.exe?_SERVICE=default
          &_PROGRAM=sashelp.webprog.filesrv.scl&_FILETYP=e
          &_file=path\dataset.sas7bdat&_debug=0  
    

    This example assumes the following:

    • the broker.cfg file is located in the cgi-bin directory
    • the Web server is running in the Windows operating environment (thus the need for broker.exe to be in the URL and not broker)
    • the path for FSAUTH.sas7bdat is "c:\"
    • the SAS data set (.sas7bcat) is stored in the location specified in the path statement identified in step 2.