Chapter Contents

Previous

Next
SAS Component Language: Reference

Modifying External Files

An application can enable users to modify the values in external files interactively. External files can be modified by updating existing records, by adding new records, or by deleting records. To store record values in external files, you can use functions to update the FDB with values that are stored in window variables or program variables. When you write the contents of the FDB to a file, you can update an existing record, or you can append the record at the end of the file.


Writing Modified Records or New Records to a File

In order to return values to a file that is open for writing, an application must do the following:

  1. Write each value from a window or program variable. Use the FPUT function to copy values from the SDV to the FDB.

  2. Write record values from the FDB to the external file. Use the FWRITE or FAPPEND function to write the current values to the external file and to clear the FDB.

Some operating systems do not allow new records to be appended to external files. For example, you cannot append records to members of partitioned data sets under the OS/390 operating system. If you use this type of operating system, you can append records to files by maintaining blank records in the file, usually at the end of the file. Then, when you want to add a record, you can update an existing blank record.

After a value is written to the FDB with the FPUT function, the column pointer moves to the first column following that value.

To return modified records as updates to the file's records, use the FWRITE function to overwrite each record in the physical file with the contents of the FDB. After the FDB contents are written to the file, the FDB's column pointer is positioned in column 1, and the FDB is filled with blanks.


Chapter Contents

Previous

Next

Top of Page

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