Previous Page | Next Page

SAS Component Language Dictionary

FCOL



Returns the current column position from the File Data Buffer (FDB)
Category: External File

Syntax
Details
Example
See Also

Syntax

col-num=FCOL(file-id);

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


Details

Use FCOL in conjunction with FPOS to move the pointer in the FDB and manipulate the data.


Example

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


See Also

FPOS

FPUT

FWRITE

Previous Page | Next Page | Top of Page