• Print  |
  • Feedback  |

Knowledge Base


TS-556

CATALOG, FTP, and SOCKET ACCESS Methods for 6.09E, MVS

The CATALOG, FTP, and SOCKET ACCESS Methods are available in TSLEVEL 455 of Release 6.09E on MVS via the FILENAME statement. This initial implementation has an experimental status and will be replaced by the "XX" AMS ACCESS Methods in a future release of The SAS System.

FTP ACCESS Method:

Syntax

FILENAME fileref 'pgm=sasxftp'
pgmparm = 'hostname filename username password lrecl recfm';

where:

fileref is any valid SAS name.

hostname is a valid IP name or IP address.

filename is a remote external file name.

username is your login username.

password is your password or PROMPT.

             if password=PROMPT, you will be prompted for the         
                password.

  lrecl     is the logical record length.

recfm = record format:

          'B'  Fixed. This is binary mode.
          'S'  Stream. This is same as B except the last record can
               be smaller than the logical record length.
          'C'  Text.

EXAMPLE 1: Reading a File from a Remote Host

filename myfile 'pgm=sasxftp'
pgmparm='ip.name.addr remote.file.name daniel PROMPT 255 C';

   data mydata;              /* Create a temporary data set */
      infile myfile;
      input x $10.;

run;

proc print data=mydata; /* Print the data */ run;

EXAMPLE 2: Writing to a File on a Remote Host

filename myfile 'pgm=sasxftp'
pgmparm='ip.name.addr remote.file.name daniel PROMPT 255 C'

data _null_;

     file myfile;
     do i=1 to 10;
        put i=;
     end;   

run;

SOCKET ACCESS Method

Syntax

FILENAME fileref 'pgm=sassoct'
pgmparm='hostname portno lrecl reconn recfm';

where:

fileref is any valid SAS name.

hostname is the reserved name SOCK_SERVER (server mode) or a

valid IP name or IP address.

portno in client mode, this is the port number of the server

            you are connecting to. If portno=0 in server mode, a 
            number will be assigned automatically.

  lrecl     is the logical record length.

reconn is the number of reconnect attempts allowed in server

mode.

  recfm     is the record format:
            'B'  Fixed. This is binary mode.
            'S'  Stream. This is same as B except last record can be
                 smaller than lrecl.

            for text files, incoming data is assumed to be ASCII
            and outgoing data will be ASCII (the data is automatically
            translated to EBCDIC).

            'L'  Text/ LF delimited.
            'C'  Text/ CRLF delimited.
            'N'  Text/ NULL (0x00) delimited.

EXAMPLE 1: Connecting to a Remote Server

filename myfile 'pgm=sassoct'

pgmparm='ip.name.addr 1897 255 0 L';

data _null_;

     file myfile;
     do i=1 to 10;
        put i=;
     end;

run;

filename myfile 'pgm=sassoct'

pgmparm='ip.name.addr 1897 255 0 L';

data _null_;

     infile myfile;
      input x $10.;

run;

EXAMPLE 2: Connecting using Server Mode

filename myfile 'pgm=sassoct'
pgmparm='SOCK_SERVER 0 255 4 L';

   data mydata;              /* Create a temporary data set */
      infile myfile;
      input x $10.;

run;

proc print data=mydata; /* Print the data */ run;

CATALOG ACCESS Method:

Syntax

FILENAME fileref 'pgm=sasreadc'
pgmparm = 'filename';

where:

fileref is any valid SAS name.

filename is the name of a catalog entry (must be four

level name).

EXAMPLE 1: Creating a Source Entry

filename myfile 'pgm=sasreadc'

pgmparm='sasuser.profile.write.source';

data _null_;

     file myfile;
        put 'source statements';

run;

EXAMPLE 2: Using %INCLUDE to Submit Source Code from a Catalog Entry

filename dir 'pgm=sasreadc'
pgmparm='sasuser.profile.write.source';

%include dir;