Previous Page | Next Page

Functions and CALL Routines under OpenVMS

FILENAME Function: OpenVMS



Assigns or deassigns a SAS fileref for an external file, directory, or an output device.
Category: External Files
OpenVMS specifics: Valid values for filename, device-type, host-options, and dir-ref
See: FILENAME Function in SAS Language Reference: Dictionary

Syntax
Details
See Also

Syntax

FILENAME(fileref, filename<, device-type<,host-options<,dir-ref>>>)

fileref

specifies the fileref to assign to the external file. In a DATA step, fileref can be a character expression, a string enclosed in quotation marks that specifies the fileref, or a DATA step variable whose value contains the fileref. In a macro (for example, %SYSFUNC), fileref is the name of a macro variable (without an ampersand) whose value contains the fileref to assign to the external file. (For details, see the FILENAME function in SAS Language Reference: Dictionary.)

filename

specifies the external file. Specifying a blank filename (' ') deassigns the fileref that was previously assigned.

Under OpenVMS, the filename must be a valid OpenVMS pathname to the external file that you want to use. You can specify the version number of the file, for example, myfile.dat;1 .

device-type

specifies the type of device or the access method that is used if the SAS fileref points to an input or output device or location that is not a physical file:

DISK

specifies that the device is a disk drive.

DUMMY

specifies that the output to the file is discarded.

PIPE

specifies an OpenVMS command. For more information, see Reading from and Writing to OpenVMS Commands (Pipes).

PLOTTER

specifies an unbuffered graphics output device.

PRINTER

specifies a printer or printer spool file.

TEMP

specifies a temporary file that can be accessed only through the logical name and is available only while the logical name exists. If a physical pathname is specified, an error is returned. Files manipulated by the TEMP device can have the same attributes and behave identically to DISK files.

TERMINAL

specifies the user's terminal.

host-options

can be any of the following:

ALQ=

specifies how many disk blocks to allocate to a new external file. The value can range from 0 to 2,147,483,647. If the value is 0 (the default), the minimum number of blocks required for the given file format is used.

CC=

tells SAS what type of carriage control to use when it writes to external files. Values for the CC= option are

FORTRAN

indicates FORTRAN carriage-control format. This is the default for print files.

PRINT

indicates OpenVMS print format.

CR

indicates OpenVMS carriage-return carriage-control format. This is the default for nonprinting files.

DEQ=

tells OpenVMS how many disk blocks to add when it automatically extends an external file during a write operation. The value can range from 0 to 65,535. The default value is 0, telling OpenVMS RMS to use the process's default value.

FAC=

overrides the default file access attributes used for external files. Values for the FAC= option are

DEL

specifies DELETE access.

GET

specifies READ access.

PUT

specifies WRITE access.

UPD

specifies UPDATE access.

GSFCC=

specifies the file format of graphic stream files (GSF files). The accepted values are

PRINT

creates a GSF file. It is a VFC format file with carriage control set to null. These files can be used with most utilities with the exception of some file transfer protocols, such as Kermit. This is the default value for this option.

CR

creates a carriage return carriage control file.

NONE

creates a file with no carriage control. This format is useful if you plan to download the file to a personal computer.

KEY=

specifies which key SAS uses to read the records in an RMS file with indexed organization. The KEY= option is always used with the KEYVALUE= option.

KEYVALUE=

specifies the key value with which to begin reading an indexed file.

LRECL=

specifies the record length of the output file. If you do not specify a record length, the default is the value of the LRECL= system option. For the input file, the existing record length is used by default. If the LRECL= option is used, the input records are padded or truncated to the specified length.

Range: 14-32,767
See also: Maximum LRECL Values for File Types
MBC=

specifies the size of the I/O buffers that OpenVMS RMS allocates for a particular file. The value can range from 0 to 127 and represents the number of blocks used for each buffer. By default, this option is set to 0 and the default values for the process are used.

MBF=

specifies the number of I/O buffers you want OpenVMS RMS to allocate for a particular file. The value can range from 0 to 255 and represents the number of buffers used. By default, this option is set to 2. If a value of 0 is specified, the default value for the process is used.

MOD

opens the file referenced for append. This option does not take a value.

NEW

opens a new file for output. This option does not take a value.

OLD

opens a new file for output. This option does not take a value.

RECFM=

specifies the record format of the output file. Values for the RECFM= option are

F

specifies fixed length.

N

specifies binary format. The file consists of a stream of bytes with no record boundaries. If the LRECL= host option or the LRECL= system option is not specified, SAS can read up to 8,192 bytes at a time from the file.

V

specifies variable length.

SHR=

overrides the default file-sharing attributes used for external files. Values for the SHR= option are

DEL

specifies DELETE access.

GET

specifies shared READ access.

NONE

specifies no shared access.

PUT

specifies shared WRITE access.

UPD

specifies UPDATE access.

You can combine these values in any order. For additional details about these options, see the discussion of host-specific external I/O statement options for the FILENAME statement in FILENAME Statement: OpenVMS.
dir-ref

specifies the fileref that is assigned to the directory in which the external file resides.


Details

FILENAME returns 0 if the operation was successful, and a non-zero number if it was not successful.

Under OpenVMS, you can assign SAS filerefs using two methods. You can use the DCL DEFINE command to assign a fileref before you invoke SAS. For example:

$ define myfile a.txt
$ sas;
  data;
  file myfile;
  put "HELLO";
  run;

This creates the file A.TXT.

You can use the X command to assign a fileref during your SAS session.


See Also

Previous Page | Next Page | Top of Page