Chapter Contents |
Previous |
Next |
FPOINT |
Category: | External File |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
sysrc=FPOINT(file-id,note-id); |
0 | successful |
0 | not successful |
Type: Numeric
Type: Numeric
Type: Numeric
Details |
Use FNOTE to provide the note-id value that identifies the record. FPOINT determines only the record to read next. It has no impact on which record is written next. When you open the file for update, FWRITE writes to the most recently read record.
Example |
Assign the fileref MYFILE to an external file. Then attempt to open the file. If the file is opened successfully, then read the records and use NOTE3 to store the position of the third record read. Later, point back to NOTE3 to update the file, closing the file afterward.
/* Assign the fileref MYFILE to the physical */ /* filename stored in the variable FNAME */ /* and open it in UPDATE mode. */ rc=filename('myfile',fname); fileid=fopen('myfile','u'); if (fileid>0) then do; /* Read the first record. */ rc=fread(fileid); /* Read the second record. */ rc=fread(fileid); /* Read the third record. */ rc=fread(fileid); /* Note the position of the third record. */ note3=fnote(fileid); /* Read the fourth record. */ rc=fread(fileid); /* Read the fifth record. */ rc=fread(fileid); /* Point to the third record. */ rc=fpoint(fileid,note3); /* Read the third record. */ rc=fread(fileid); /* Copy the new text to the FDB. */ rc=fput(fileid,'new text'); /* Write data in the FDB to the third record. */ rc=fwrite(fileid); /* Close the file. */ rc=fclose(fileid); end; /* Clear the fileref. */ rc=filename('myfile','');
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.