FCOL Function


Returns the current column position in the File Data Buffer (FDB)

Category: External Files

Syntax

FCOL ( file-id )

Argument

file-id

  • specifies the identifier that was assigned when the file was opened, generally by the FOPEN function.

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:

  • '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




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net