• <Helps for GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Statements and Functions
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
        • Clear Function
        • Close Function
        • CountCases Function
        • DelCase Function
        • DirCreate Function
        • DirDelete Function
        • DirExist Function
        • DirList Function
        • FileConcat Function
        • FileCopy Function
        • FileCreate Function
        • FileDelete Function
        • FileEmpty Function
        • FileExist Function
        • FileName Function
        • FileRead Function
        • FileRename Function
        • FileSize Function
        • FileWrite Function
        • Find Function
        • Key Function
        • KeyList Function
        • LoadCase Function
        • Locate Function
        • NMembers Function
        • Open Function
        • Retrieve Function
        • Set Access Statement
        • SetFile Function
        • Set First Statement
        • Set Last Statement
        • Write Function
        • WriteCase Function
      • Synchronization Functions
    • Templated Reporting System
    • Appendix
  • <Helps for CSEntry>
  • <Helps for CSBatch>
  • <Helps for CSTab>
  • <Helps for DataViewer>
  • <Helps for TextView>
  • <Helps for TblView>
  • <Helps for MapView>
  • <Helps for TRSWin>
  • <Helps for CSDeploy>
  • <Helps for CSPack>
  • <Helps for CSFreq>
  • <Helps for CSSort>
  • <Helps for CSExport>
  • <Helps for CSReFmt>
  • <Helps for CSDiff>
  • <Helps for CSConcat>
  • <Helps for TRSSetup>
  • <Helps for ParadataViewer>
  • <Helps for ParadataConcat>
  • <Helps for ShpToMap>
  • <Helps for CSIndex>
  • <Helps for Excel2CSPro>
  • <Helps for CSWeb>

SetFile Function

 

Format:

b = setfile(ext-dict-name | file-name, alpha-exp

              [, update | append | create]);

 

Description:

The setfile function assigns a new physical file to a dictionary or declared file.

 

The ext-dict-name or file-name must be supplied. Ext-dict-name is the name of a data dictionary defining an external data file. File-name is the name of a file declared in a file statement.

 

Alpha-exp is an alphanumeric expression containing the folder and file name of the file to be attached.

 

The keywords update, append or create are optional. If no keyword is coded, the file is opened in update mode.

 

When an ext-dict-name is used, if update or append is used, when the file is opened, its contents are not changed, and the file is ready to update cases. If create is coded, when the file is opened, all previous records are removed and the file is ready to add cases.

 

When a file-name is used, if update is used when the file is opened, you are positioned at the beginning of the file. If append is coded, when the file is opened, its contents are not changed, and you are positioned at the end of the file. If create is coded, when the file is opened, all previous records are removed and you are positioned at the beginning of the file.

 

In both cases, if create or append is used and the file does not already exist, a new empty file will be created. If update is used and the file does not already exist, the function will fail and return 0.

 

Return value:

The function returns a logical value of 1 (true) if the new physical file is successfully assigned and 0 (false) otherwise.

 

Example 1:

OK = setfile(LOOKUP, "c:\My Lookup File.dat");

 

Example 2:

OK = setfile(REPORT, REPORT_FILE_NAME, create);

 

See also: File Statement, Filename Function, Setoutput Function