FNOTE Function


FNOTE Function

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

Category: External Files

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 Function' on page 508

  • 'FCLOSE Function' on page 519

  • 'FILENAME Function' on page 529

  • 'FOPEN Function' on page 550

  • 'FPOINT Function' on page 554

  • 'FPUT Function' on page 557

  • 'FREAD Function' on page 558

  • 'FREWIND Function' on page 559

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