Chapter Contents

Previous

Next
FOPEN

FOPEN



Opens an external file and returns a file identifier value

CMS specifics: You must close FOPEN files with the FCLOSE function


Syntax
Details
See Also

Syntax

FOPEN (fileref <,open-mode <,record-length <,record-format>>>)

fileref
specifies the fileref that you assign to the external file. You can assign filerefs by using the FILENAME statement or the FILENAME function.

open-mode
specifies the type of access to the file:
A APPEND mode allows writing new records after the current end of the file.
I INPUT mode allows reading only. (default)
O OUTPUT mode defaults to the OPEN mode specified in the host option in the FILENAME statement or function. If no host option is specified, it allows writing new records at the beginning of the file.
S Sequential mode can be used for pipes and other sequential devices such as READER.
U UPDATE mode allows both reading and writing.

record-length
specifies the logical record length of the file. To use the existing record length for the file, specify a length of 0, or do not provide a value here.

record-format
specifies the record format of the file. To use the existing record format, do not specify a value here. Valid values are:
B data are to be interpreted as binary data.
D use default record format.
E use editable record format.
F file contains fixed length records.
P file contains printer carriage control in host-dependent record format.
V file contains variable length records.


Details

Under CMS, you must close files that you open with FOPEN using the FCLOSE function at the end of a DATA step; files are not closed automatically after processing.

See FINFO for an example that demonstrates the use of the FOPEN, FCLOSE, FINFO, FILENAME, FOPTNAME and FOPTNUM functions.

See Also


Chapter Contents

Previous

Next

Top of Page

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