SAS Companion for the OpenVMS Operating Environment |
You
can create a file in the OpenVMS operating
environment with a variety of editors. When you create a file, you must give
it a unique name. A fully qualified name indicates how a file
fits into the file structure (a system of directories and subdirectories)
that contains all the files stored under the OpenVMS system.
The following sections describe this file structure and discuss the components
of a fully qualified name.
In the
OpenVMS environment,
files are organized into directories. A directory contains a
list of all the files that are organized within that directory. When you log
in, OpenVMS attaches your session to
a directory on a default disk that is associated with your user ID. This directory
is called your home directory. For each user ID, there is only
one home directory. Often the home directory name is the same as the user
ID.
The home
directory can contain both files and other directories called subdirectories. Subdirectories can also contain files and subdirectories. The terms
directory and subdirectory refer to the same type of file unit. The term subdirectory
conveys the relationship of one directory to another in the hierarchical structure
that begins with the home directory.
This method of structuring files enables you to group sets of
related files within directories. You can organize your files however you
like. Directory File Structure
illustrates the directory file structure.
Directory File Structure
The directory
that you are working in at any given time
is called your default directory. For example, when you log in,
your home directory is usually your default directory.
Creating Directories
To create a directory, use the DCL
CREATE/DIRECTORY command.
Changing Your Default Directory
To move from one directory to
another directory in the file structure,
use the DCL SET DEFAULT command. Each
time you use the DCL SET DEFAULT command,
your default directory changes to the directory that you specify. Be sure
to specify a pathname to the target directory. (A full pathname follows an
unbroken path from the first-level directory down to the target subdirectory.
However, a partial pathname, such as [.SUBDIR], can
also be specified.) Using Directory File Structure
as an example, the following command specifies the full pathname to the subdirectory SUBDIRC:
$ SET DEFAULT [HOMEDIR.SUBDIR2.SUBDIRC]
When this command executes, SUBDIRC becomes
the default directory.
If you have any doubt about your current location in
the file structure, use the DCL SHOW DEFAULT command
to show your default directory. Keeping track of your default directory helps
you keep track of files. For example, some programs write output files to
the default directory.
Files contain
various
types of data, programming statements, or program output. Under OpenVMS, you
can create files with several editors, including the EVE and EDT editors,
the Text Processing Utility (TPU) Editor, and the SAS Text Editor. Regardless
of which editor you use, each file must have a unique name within that directory.
The
following type of file specification is called a fully qualified name because it completely indicates how the file fits into the file
structure:
node::device:[directory]filename.file-type;version
|
A file specification cannot
exceed 255 characters. The directory and file-specification can each consist of up to 39
characters. The file-type
can consist of up to 38 characters, although
most of the default file types have only 3 characters. Permissible
characters are the letters A through Z, the numbers 0 through 9, an underscore (_), a
hyphen (-), or a dollar sign ($). However,
do not use a hyphen as the first character of file-specification nor as the last character of file-type.
OpenVMS filenames
and file types are not case-sensitive. For more information about file specifications,
refer to OpenVMS User's Manual.
In many cases you can uniquely identify a file even
without specifying all of the fields in a fully qualified name. The following
definitions give default values for fields that can be omitted from a file
specification:
- node
- specifies a node name in an OpenVMS network.
The node specification is always followed by a double colon (::). The default
value for node is your OpenVMS system
node; therefore, include node in the fully qualified
name only when you require access to a file that is located on a different
node in your OpenVMS network.
- device
- specifies the name of the physical or logical
disk or the physical tape that contains the file. The device specification
is always followed by a single colon (:). The
default value for device is your current disk.
When you log in, the default disk is the disk that is associated with your
user ID. Include device in the fully qualified
name only when you need to access a tape file or a file on another disk.
- directory
- specifies the name of a directory or a sequence
of directories. The directory specification must be enclosed in brackets;
for example, [DIR1.DIR2.DIR3]. The directories that follow the first directory
in the sequence are called subdirectories. In the previous example, DIR2 is
a subdirectory of DIR1 and DIR3 is a subdirectory of DIR2.
The default value for directory is the default directory.
Include directory in the fully qualified name only when you need to access
a file that is not in your default directory. (For more information about
the default directory, see Directories.)
Note: You can substitute angle brackets
(<
>) for square brackets ([ ]) in
directory specifications.
- file-specification
- specifies the name of a particular file
within the directory. If the file is a SAS file, the filename must also comply
with SAS naming conventions. (For details about SAS naming conventions, see SAS Language Reference: Dictionary.)
The file-specification field has no default value
unless you use a wildcard character.
- file-type
- usually describes the contents of the file.
The file-type must be preceded by a period (.).
The default value for
file-type
depends on how the file is created or used. For example, some DCL commands
assume default file types. You can assign a file type when you create a file.
-
version
- specifies the version number of the file.
Each time you modify or create and save a file, OpenVMS increments
the highest existing version number for that file and adds the new version
to the directory. Version numbers can range from 1 to 32767. If you request
a file without specifying the version number, then you access the latest version
of the file by default. (The latest version of the file is the one that has
the highest version number.) If you specify a version number, you must precede
it with either a semicolon (;) or a
period (.).
Your system manager sets the maximum number of versions
of a file that are saved at any given time. For example, if you have edited
a file named [DIR1] PROG.DAT 1,000
times and your system is set to keep four backup versions, then the directory
[DIR1] contains the following versions:
PROG.DAT;1000
PROG.DAT;999
PROG.DAT;998
PROG.DAT;997
When you edit PROG.DAT the
next time (version 1001), PROG.DAT;1001 is
created and PROG.DAT;997 is deleted.
Special Characters in OpenVMS Filenames
OpenVMS supports two general-purpose wildcard characters: the
asterisk (*) and the percent sign (%). In DCL commands, you can use these
wildcard characters in file specifications to operate on a group of files
instead of on a specific file.
The asterisk (*) replaces zero or more characters in
one or more of the directory, file-specification, file-type,
and version fields in a file specification. It
causes the DCL command to act on all files whose names match the fields that
you include in the specification. For example, all of the following file specifications
match CAT.SAS:
- *.SAS
- CA*.SAS
- CAT*.SAS
- *A*.SAS
- CAT.*
The
asterisk (*) often references sets of files in DCL
commands such as PRINT, TYPE, and COPY. For
example, the following command prints all versions of all files in directory
[DIR1] that have the file type .SAS:
$ PRINT [DIR1]*.SAS;*
The percent sign (%) replaces a single character in directory, file-specification,
and file-type fields in the file specification.
For example, the following command prints all versions of every file whose
name has five characters beginning with the letters PROG and whose file type
is .SAS:
$ PRINT PROG%.SAS;*
In other words, you can use the previous example to
print files PROG1.SAS through PROG9.SAS,
but not file PROG10.SAS. To print all
versions of every file whose name begins with the letters PROG and whose file
type is .SAS, enter the following command:
$ PRINT PROG*.SAS;*
Note: Using wildcard characters
in file specifications can degrade the performance of your operating environment.
For additional rules for using wildcard specifications
in operations across nodes in a network, refer to OpenVMS Networking
Manual.
For information about using wildcards in file and directory
specifications, see Using Wildcard Characters in External File Specifications.
The file-type portion of a filename often indicates the contents
of the file. Both OpenVMS and the SAS
System use default file types for output files. DCL commands that create files
often assign default file types if you omit file-type
in the file specification. When you assign file types to files you create,
keep in mind that either OpenVMS or
SAS may require a certain file type, depending on how a file is used. The
following is a list of commonly used OpenVMS file
types:
For a complete list of OpenVMS file
types, refer to OpenVMS User's
Manual.
The SAS System uses unique file types to distinguish between
SAS files and OpenVMS external files
in a directory.
- CAUTION:
- Do not change these file types.
The file types in the following sections are an integral
part of how the SAS System accesses files under OpenVMS. Changing
the file types can cause unpredictable results.
File Types for SAS Files
Most of the file types that the SAS System uses are
assigned
to files that are described as either temporary or permanent SAS files. A SAS file is stored in a SAS data library and is referred to as
a member of a library. Each member has a member type.
The SAS System equates some OpenVMS file
types with a general set of SAS member types that it uses under all operating
environments.
In Version 7 and 8 of the SAS System, the names of these file types
have the following form:
where engine-name is the name of the SAS engine, such
as SASV7 or SASS7, and filetype is the type of file. For example,
the SASV7DAT file type is a data file that is accessed by the SASV7 engine.
For information about SAS engines, see
Using SAS Engines.
In addition, for Version 7 and Version 8, two types
of SAS temporary files exist, with OpenVMS file
types of .SAS7BUTL and .SAS7BPUT.
These files appear only in the SASWORK data library.
File Types for External Files
External files can be processed by other programs and by the FILENAME function
and the %INCLUDE, FILE, and INFILE statements
in the SAS DATA step. (For more information
about external files, see Using External Files and Devices.)
The SAS System uses the following OpenVMS file
types for external files:
-
.DAT
- is an external file that contains data lines.
This is the default file type that SAS uses when it is reading and writing
lines with the INFILE and FILE statements.
(For more information, see Default File Types.)
-
.LIS
- is an external file that contains SAS procedure
output. By default, the filename of the .LIS file matches the filename of
the .SAS program file that generated the output.
-
.LOG
- is the external file that contains the SAS
log. By default, the filename of the .LOG file matches the of the SAS program
file that generated it.
-
.SAS
- is a SAS program file--that is, an
external file that contains SAS statements. Use this file type when you create
a file that contains a SAS program. This is the default file type for the
FILE command and for the %INCLUDE statement.
-
.TLB
- is an OpenVMS text
library. The SAS System can access text libraries as external file aggregates.
Text library files typically store data or SAS programs that are related.
For example, you may want to store all SAS programs that are associated with
a particular application in one text library. (For more information about OpenVMS text
libraries, refer to OpenVMS Librarian
Utility Manual.) OpenVMS text
libraries are also often used to store SAS macros. (For more information about
SAS macros, see Macro Facility.)
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.