SAS Component Language Dictionary |
Category: | External File |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
sysrc=FREAD(file-id); |
contains the return code for the operation:
0 | |
0 |
contains the identifier that was assigned when the file was opened. If file-id is invalid, the program halts.
Details |
The position of the file pointer is automatically updated after the read operation so that successive FREAD functions read successive file records.
Use FNOTE, FPOINT, and FREWIND to position the file pointer explicitly.
Example |
Assign the fileref MYFILE to an external file and attempt to open the file. Read each record from the file and list it in the LOG window.
/* Assign the fileref MYFILE to the physical */ /* filename stored in the variable FNAME */ /* and open it. */ rc=filename('myfile',fname); fileid=fopen('myfile'); if (fileid>0) then do while(fread(fileid)=0); rc=fget(fileid,c,200); put c; end; rc=fclose(fileid); rc=filename('myfile','');
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.