Previous Page | Next Page

SAS Component Language Dictionary

DOPEN



Opens a directory
Category: Directory

Syntax
Details
Example
See Also

Syntax

directory-id=DOPEN(fileref);

directory-id

contains the return code for the operation:

0

indicates that the directory could not be opened.

>0

is the identifier that was assigned to the opened directory.

Type: Numeric

fileref

is the fileref that is assigned to the directory.

Type: Character


Details

DOPEN opens a directory and returns a directory identifier value (a number greater than 0), which can then be used to identify the open directory to other SCL functions. The directory to be opened must be identified by a fileref. You must associate a fileref with the directory before calling DOPEN.

You can assign filerefs by using either the FILENAME statement or the FILENAME function in SCL. Under some operating systems, you can also use system commands to assign filerefs.

Operating Environment Information:   The term directory used in the description of this function and related SCL functions refers to an aggregate grouping of files that are managed by the host operating system. Different host operating systems identify such groupings with different names, such as directory, subdirectory, MACLIB, or partitioned data set. See the SAS documentation for your operating environment for details.  [cautionend]


Example

Assign the fileref MYDIR to a directory. Then open the directory, determine how many system-dependent directory information items are available, and close the directory. DIRNAME is an SCL variable with a value that represents the actual name of the directory in the form required by the host operating system.

rc=filename('mydir',dirname);
did=dopen('mydir');
infocnt=doptnum(did);
rc=dclose(did);


See Also

DCLOSE

FOPEN

MOPEN

Previous Page | Next Page | Top of Page