Chapter Contents

Previous

Next
FILENAME

FILENAME



Associates a SAS fileref with an external file or a logical file device

Valid: anywhere in a SAS program
OS/2 specifics: Valid values for access-method; valid values for device-type; valid filenames for external-file; valid options in host-option-list


Syntax
Details
See Also

Syntax

FILENAME fileref <device-type> 'external-file' <host-option-list>;
FILENAME fileref device-type <'external-file'> <host-option-list>;
FILENAME fileref <device-type> ('directory-1'<,...directory-n'>) <host-option-list>;

Note:   This is a simplified version of the FILENAME statement syntax. For the complete syntax and its explanation, see the FILENAME statement in SAS Language Reference: Dictionary.  [cautionend]

fileref
is any valid fileref, as discussed in Using a Fileref.

For examples of using filerefs in member name syntax (also called aggregate syntax), see Assigning a Fileref to a Directory. For the rules the SAS System uses when accessing files through filerefs, see Understanding How Concatenated Directories Are Accessed.

Note:   The words CON, NUL, PRN, KBDS, LPT0 - LPT3, and COM1 - COM3 are reserved words under OS/2. Do not use them as filerefs.   [cautionend]

device-type
enables you to read and write data from devices rather than files. The following are valid values:

CATALOG
reads a SAS catalog as an external flat file.

COMMPORT
reads data from and writes data to a communications port.

DDE
reads data from and writes data to another application using Dynamic Data Exchange. For more information, see DDE Syntax within SAS.

DISK
reads data from and writes data to a disk file. Under OS/2, DISK is the default for device-type.

DRIVEMAP
displays information about the available hard drives (local and networked).

DUMMY
specifies a null output device. This value is especially useful in testing situations.

EMAIL
lets you send electronic mail programmatically from the SAS System. For more information, see Sending E-Mail from within the SAS System.

FTP
lets you access information on other machines using TCP/IP. You must have TCP/IP software installed on your local machine. You must also be able to connect to a machine that can function as an FTP server. For more information about the using the FTP access method, see the FILENAME statement in SAS Language Reference: Dictionary.

NAMEPIPE
writes data to a named pipe. For more information, see Using Named Pipes.

PIPE
writes data to an unnamed pipe. For more information, see Using Unnamed Pipes.

PLOTTER
indicates that you are accessing a plotter. The OS/2 printer is not used. This device-type keyword is used solely in conjunction with SAS/GRAPH software.

PRINTER
indicates that you are accessing a printer file or device. By default, output is routed through the default OS/2 printer when you use this device-type keyword. For more information about altering your default printer, see the system option SYSPRINT.

SOCKET
lets you read and write information over a TCP/IP socket. You must have TCP/IP software installed on your local machine. The SOCKET access method uses the nonblocking method of issuing socket requests. For more information about the using the SOCKET access method, see the FILENAME statement and FILENAME function in SAS Language Reference: Dictionary.

TEMP
creates a temporary file that exists only as long as the filename is assigned. The temporary file can only be accesssed through the logical name and is only available while the logical name exists. A physical path name is never shown to the user. If a physical path name is specified, an error is returned. Files manipulated by the TEMP device can have the same attributes and behave identically to DISK files.

For an example of specifying a device type in the FILENAME statement, see Advanced External I/O Techniques.

Note:   The TAPE and TERMINAL device-type keywords (documented in SAS Language Reference: Dictionary) are not applicable to the OS/2 operating environment. If you use one of these device-type keywords in your SAS program under OS/2, you receive an error message. Also, while the DISK device-type keyword is accepted under OS/2, it is ignored because disk files are the default under OS/2.  [cautionend]

external-file
can be any valid OS/2 file specification enclosed in quotes (for more information, see Using a Quoted OS/2 Filename). If you use the PRINTER device-type keyword, you must then identify the printer by its name (as it is defined to OS/2) rather than by the physical port that it is attached to. For example:
filename groupHP printer 
   "HP LaserJest 4si, 1st floor";

host-option-list
names external I/O statement options specific to OS/2. They can be any of the following:

ALTDEST=filename
is for use only with the PRINTER device type. Filename specifies a file destination to write to when you direct output to the fileref. Although the output is written to disk and not to the printer, the output is still formatted using the printer driver associated with the printer that you specified with the external-file argument. For example,
filename groupHP printer 
   "HP LaserJest 4si, 1st floor" 
   altdest=
      "C:\My SAS Files\Printer output\out.prn";
uses the printer driver associated with the named printer (an HP LaserJet 4si) to create the output in out.prn. No output is actually sent to the printer when you use this fileref.

BAUD=baud-rate
sets the baud rate. The value for baud-rate depends on your communications hardware and must be an integer. This host-option is valid only if you specify the COMMPORT device-type keyword.

BITS=transmission-bits
sets the transmission bits. For OS/2, transmission-bits must be an integer in the range 5-8. This host-option is valid only if you specify the COMMPORT device-type keyword.

BLKSIZE=block-size
BLK=block-size
specifies the number of btyes that are physically read or written in an I/O operation. The default is 8K. The maximum is 1M.

BLOCK | NOBLOCK
is used only in the context of named pipes. This option indicates whether the client is to wait if no data are currently available. BLOCK is the default value.

BYTE | MESSAGE
is used only in the context of named pipes. This option indicates the type of pipe. BYTE is the default value.

COMMAND
is used only in the context of Dynamic Data Exchange (DDE). This option enables you to issue a remote command for applications that do not use the SYSTEM topic name. For more information, see Referencing the DDE External File and Controlling Another Application Using DDE.

COMTIMEOUT=value
controls how a communications port timeout is handled. A timeout occurs when no data are available at the communications port for a period of time, usually 60 seconds. The COMTIMEOUT= option can have the following values:
EOF returns an end-of-file (EOF) character when a timeout occurs. This is the default behavior. The EOF character causes the current DATA step to terminate.
WAIT instructs the communications port to wait forever for data. In other words, this value overrides the timeout. In this case, no record is returned to the DATA step until data are available. This can cause your program to go into an infinite loop, so use this value with caution.
ZERO returns a record length of 0 bytes when a timeout occurs. However, the DATA step does not terminate; it simply tries to read data again.

This host option is valid only if you specify the COMMPORT device-type keyword.

DROPNULL=
is used to discard null bytes when received. The valid values are:
ON specifies to discard null bytes when received.
OFF specifies not to discard null bytes when received. OFF is the default value.

This host-option is valid only if you specify the COMMPORT device-type keyword. For example:

filename portin commport 'com1:' dropnull=off;

EOFCONNECT
is used only in the context of named pipes and is valid only when defining the server. This option indicates that if an end-of-file (EOF) character is received from a client, the server should try to connect to the next client.

FLOW=value
controls the transmission control flow. The possible values for value are XONXOFF, DTRDSR, or RTSCTS. This host-option is valid only when you specify the COMMPORT device-type keyword.

HOTLINK
is used only in the context of Dynamic Data Exchange (DDE). For a complete description and an example of using this option, see Using the DDE HOTLINK.

LRECL=record-length
specifies the record length (in bytes). Under OS/2, the default is 256. The value of record-length can range from 1 to 1,048,576 (1 megabyte).

MOD
specifies that output should be appended to an existing file.

NOTAB
is used only in the context of Dynamic Data Exchange (DDE). This option enables you to use non-tab character delimiters between variables. For more information about this option, see Using the NOTAB Option with DDE.

PARITY=parity-bit
sets the parity check bit. Possible values for parity-bit are NONE, ODD, EVEN, MARK, or SPACE. This host-option is valid only if you specify the COMMPORT device-type keyword.

RECFM=record-format
controls the record format. The following values are valid under OS/2:
F indicates fixed format.
N indicates binary format and causes the file to be treated as a byte stream.
P indicates print format.
S370V indicates the variable S370 record format (V).
S370VB indicates the variable block S370 record format (VB).
S370VBS indicates the variable block with spanned records S370 record format (VBS).
V | D indicates variable format. This is the default.

The S370 values are valid with OS/390-style files only--that is, files that are binary, have variable-length records, and are in EBCDIC format. If you want to use a fixed-format OS/390 (formerly known as MVS) file, first copy it to a variable-length, binary OS/390 file.

RETRY=seconds
is used only in the context of named pipes. This option specifies how long a named pipe client should wait for a busy pipe. The minimum (and default) value for seconds is 10.

RTIMEOUT=seconds
specifies the read time-out value in 0.01 of a second (100 = 1 second). This host-option is valid only if you specify the COMMPORT device-type keyword.

SERVER | CLIENT
is used only in the context of named pipes. This option specifies the mode of a named pipe. The default value is SERVER.

STOP=stop-bit
sets the stop bit. Possible values for stop-bit are ONE, TWO, and ONEHALF. This host-option is valid only if you specify the COMMPORT device-type keyword.

WTIMEOUT=seconds
specifies the write time-out value in 0.01 of a second (100 = 1 second). This host-option is valid only if you specify the COMMPORT device-type keyword.


Details

The FILENAME statement temporarily associates a valid SAS name with an external file or an output device. An external file is a file created and maintained in the OS/2 operating environment from which you need to read data.

See Also


Chapter Contents

Previous

Next

Top of Page

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