![]() Chapter Contents |
![]() Previous |
![]() Next |
| FPOS |
| Category: | External Files |
| Syntax | |
| Arguments | |
| Details | |
| Examples | |
| See Also |
Syntax |
| FPOS(file-id,nval) |
| Details |
FPOS returns 0 if
the operation was successful,
0 if it was not successful. If the specified
position is past the end of the current record, the size of the record is
increased appropriately. However, in a fixed block or VBA file, if you specify
a column position beyond the end of the record, the record size does not change
and the text string is not written to the file.
| Examples |
This example assigns the fileref MYFILE to an external file and attempts to open the file. If the file is opened successfully, indicated by a positive value in the variable FID, it places data into the file's buffer at column 12, 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 dataline=This is some data.;
/* Position at column 12 in the FDB. */
%let rc=%sysfunc(fpos(&fid,12));
/* Put the data in the FDB. */
%let rc=%sysfunc(fput(&fid,&dataline));
/* Write the record. */
%let rc=%sysfunc(fwrite(&fid));
/* Close the file. */
%let rc=%sysfunc(fclose(&fid));
%end;
%let rc=%sysfunc(filename(filrf));
| See Also |
| Functions:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.