SAS Component Language Dictionary |
Closes an external file, a directory, or a directory member
-
sysrc
-
contains the return code for the operation:
0 |
successful |
0 |
not successful |
Type:
Numeric
-
file-id
-
contains the identifier that was assigned
when the file was opened. A file-id value of -999
closes all files opened with FOPEN. If file-id contains an invalid value, the program
halts.
Type: Numeric
Close a file after manipulating it:
/* Assign the fileref THEFILE to the physical */
/* filename that is stored in the variable FNAME */
/* and open it in append mode. */
rc=filename( 'thefile',fname);
fileid=fopen('thefile');
if (fileid>0) then
do;
rc=fread(fileid);
rc=fclose(fileid);
end;
else
do;
_msg_=sysmsg();
return;
end;
rc=filename('thefile','');
DCLOSE
DOPEN
FOPEN
MOPEN
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.