SAS Component Language Dictionary |
Reads a record from an external file into the File Data Buffer
(FDB)
-
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. If file-id is invalid,
the program halts.
Type: Numeric
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.
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','');
FGET
FNOTE
FPOINT
FREWIND
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.