Chapter Contents |
Previous |
Next |
FCOL |
Category: | External Files |
Syntax | |
Argument | |
Details | |
Examples | |
See Also |
Syntax |
FCOL(file-id) |
Details |
Use FCOL combined with FPOS to manipulate data in the File Data Buffer (FDB).
Examples |
This example assigns the fileref MYFILE to an external file and attempts to open the file. If the file is successfully opened, indicated by a positive value in the variable FID, it puts more data into the FDB relative to position POS, writes the record, and closes the file:
%let filrf=myfile; %let rc=%sysfunc(filename(filrf, physical-filename)); %let fid=%sysfunc(fopen(&filrf,o)); %if (&fid > 0) %then %do; %let record=This is data for the record.; %let rc=%sysfunc(fput(&fid,&record)); %let pos=%sysfunc(fcol(&fid)); %let rc=%sysfunc(fpos(&fid,%eval(&pos+1))); %let rc=%sysfunc(fput(&fid,more data)); %let rc=%sysfunc(fwrite(&fid)); %let rc=%sysfunc(fclose(&fid)); %end; %let rc=%sysfunc(filename(filrf));
The new record written to the external file is
This is data for the record. more data
See Also |
Functions:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.