Chapter Contents

Previous

Next
FNOTE

FNOTE



Identifies the last record that was read and returns a value that FPOINT can use

Category: External Files


Syntax
Argument
Details
Examples
See Also

Syntax

FNOTE(file-id)

Argument

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


Details

You can use FNOTE like a bookmark, marking the position in the file so that your application can later return to that position using FPOINT. The value returned by FNOTE is required by the FPOINT function to reposition the file pointe r on a specific record.

To free the memory associated with each FNOTE identifier, use DROPNOTE.


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, then it reads the records, stores in the variable NOTE 3 the position of the third record read, and then later uses FPOINT to point back to NOTE3 to update the file. After updating the record, it closes the file:

%let 
fref=MYFILE;
%let rc=%sysfunc(filename(fref,
   physical-filename));
%let fid=%sysfunc(fopen(&fref,u));
%if &fid > 0 %then
   %do;
      %let rc=%sysfunc(fread(&fid));
         /* Read second record. */
      %let rc=%sysfunc(fread(&fid));
         /* Read third record. */
      %let rc=%sysfunc(fread(&fid));
         /* Note position of third record. */
      %let note3=%sysfunc(fnote(&fid));
         /* Read fourth record. */
      %let rc=%sysfunc(fread(&fid));
         /* Read fifth record. */
      %let rc=%sysfunc(fread(&fid));
         /* Point to third record. */
      %let rc=%sysfunc(fpoint(&fid,&note3));
         /* Read third record. */
      %let rc=%sysfunc(fread(&fid));
         /* Copy new text to FDB. */
      %let rc=%sysfunc(fput(&fid,New text));
         /* Update third record  */
         /* with data in FDB. */
      %let rc=%sysfunc(fwrite(&fid));
         /* Close file. */
      %let rc=%sysfunc(fclose(&fid));
   %end;
%let rc=%sysfunc(filename(fref));

See Also

Functions:

DROPNOTE
FCLOSE
FILENAME
FOPEN
FPOINT
FPUT
FREAD
FREWIND
FWRITE
MOPEN


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.