Chapter Contents

Previous

Next
FILENAME

FILENAME



Assigns or deassigns a SAS fileref for an external file, directory, or an output device and returns a value

Language element: function
Category: external-file
OpenVMS specifics: valid values for file-specification, device, and dir-ref


Syntax
Details
See Also

Syntax

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

fileref
in a DATA step, specifies the SAS fileref to assign to an external file. (For details, see the FILENAME function in SAS Language Reference: Dictionary.) In Version 8, you can specify the version number of the file, for example, myfile.dat;1.

file-specification
specifies the external file. Specifying a blank file-specification deassigns one that was previously assigned.

device
specifies the type of device if the SAS fileref points to an output device rather than to a physical file:

DISK
specifies a disk.

DUMMY
specifies that the output to the file is discarded.

GTERM
specifies the graphics on the user's terminal.

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.

TAPE
specifies a tape driver or tape device.

TEMP
specifies a temporary file that can only be accessed through the logical name and is only available 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 the SAS System 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.

LINESIZE=
specifies the line size for input or output. The value can range from 10 to 32,768. The default is 80 for interactive jobs (interactive line mode and the SAS windowing environment) and 132 for noninteractive and batch jobs for print files.

LRECL=
specifies the record length of the output file. If you do not specify a record length, the default is varying length records. For input, 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.

The maximum record size for OpenVMS is 32,767. LRECL values greater than 32,767 are valid only when reading and writing to tape. If an LRECL value greater than 32,767 is specified when writing to a non-tape device, the LRECL value is set 32,767. You should use the maximum LRECL values for the various file types provided in 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 form 0 to 127 and represents the number of buffers used. By default, this option is set to 2 buffers. 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.

PAGESIZE=
specifies the page size for output. The default is the display setting for interactive jobs (interactive line mode and the SAS windowing environment) and 60 for noninteractive and batch jobs. The value can range from 20 to 500.

RECFM=
specifies the record format of the output file. Values for the RECFM= option are
F specifies fixed length.
V specifies variable length.
D specifies you are accessing unlabeled tapes with the PUT and INPUT DATA step statements. For more information, see Reading from an Unlabeled Tape.

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.

dir-ref
specifies the SAS fileref that is assigned to the directory in which the external file resides.


Details

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


Chapter Contents

Previous

Next

Top of Page

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