SAS Component Language Dictionary |
Returns the current column position from the File Data Buffer
(FDB)
-
col-num
-
contains the current column position.
Type: Numeric
-
file-id
-
contains the identifier that was assigned
when the file was opened. If file-id contains
an invalid value, the program halts.
Type: Numeric
Use FCOL in conjunction with FPOS to move the pointer
in the FDB and manipulate the data.
Use FCOL and FPOS to set the pointer in the FDB:
/* Assign the fileref THEFILE to the physical */
/* filename that the user entered in the field */
/* FNAME. */
rc=filename( 'thefile',fname);
fileid=fopen('thefile','o');
if (fileid>0) then do;
/* Put data into the FDB, get the */
/* current column, move the pointer */
/* by 1 and add more data to the FDB. */
record='This is data for the record';
rc=fread(fileid);
rc=fput(fileid,record);
pos=fcol(fileid);
rc=fpos(fileid,pos+1);
rc=fput(fileid,'and more data');
rc=fwrite(fileid);
rc=fclose(fileid);
end;
rc=filename('thefile','');
The record written to the external file is
This is data for the record and more data
FPOS
FPUT
FWRITE
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.