Positions the file pointer to the start of the file.
Category: | External Files |
%let filrf=myfile;
%let rc=%sysfunc(filename(filrf,
physical-filename));
%let fid=%sysfunc(fopen(&filrf));
%let rc=0;
%do %while (&rc ne −1);
/* Read a record. */
%let rc=%sysfunc(fread(&fid));
%end;
/* Reposition pointer to beginning of file. */
%if &rc = −1 %then
%do;
%let rc=%sysfunc(frewind(&fid));
/* Read first record. */
%let rc=%sysfunc(fread(&fid));
/* Read first token */
/* into macro variable VAL. */
%let rc=%sysfunc(fget(&fid,val));
%put val=&val;
%end;
%else
%put Error on fread=%sysfunc(sysmsg());
%let rc=%sysfunc(fclose(&fid));
%let rc=%sysfunc(filename(filrf));