Previous Page | Next Page

SAS Component Language Dictionary

FCLOSE



Closes an external file, a directory, or a directory member
Category: External File

Syntax
Example
See Also

Syntax

sysrc=FCLOSE(file-id);

sysrc

contains the return code for the operation:

0

successful

[ne]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


Example

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','');


See Also

DCLOSE

DOPEN

FOPEN

MOPEN

Previous Page | Next Page | Top of Page