Returns the current column position in the File Data Buffer (FDB)
Category: External Files
FCOL ( file-id )
file-id
specifies the identifier that was assigned when the file was opened, generally by the FOPEN function.
Use FCOL combined with FPOS to manipulate data in the File Data Buffer (FDB).
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
Functions:
'FCLOSE Function' on page 519
'FOPEN Function' on page 550
'FPOS Function' on page 556
'FPUT Function' on page 557
'FWRITE Function' on page 564
'MOPEN Function' on page 656