Purpose
 
 
 Read in
 
 
 
 
 
 
  or write an array or set of strings to a file.
 
  Synopsis
 
 
 procedure diskdata(format:integer, file:string, a:array)
 
 
 procedure diskdata(format:integer, file:string, s:set)
 
 
 procedure diskdata(format:integer, file:string, l:list)
 
 
  Arguments
 
 
 
  
   | 
     format 
     | 
     Format options:
     
     
      
       | 
         ETC_DENSE 
         |  |  
       | 
         ETC_SPARSE 
         |  |  
       | 
         ETC_SGLQ 
         | 
         strings quoted with single quotes
         |  
       | 
         ETC_NOQ 
         | 
         strings are not quoted in the file
         |  
       | 
         ETC_OUT 
         |  |  
       | 
         ETC_APPEND 
         | 
         append output to the end of an existing file
         |  
       | 
         ETC_TRANS 
         |  |  
       | 
         ETC_IN 
         |  |  
       | 
         ETC_NOZEROS 
         | 
         skip zero values when processing several arrays at the same time
         |  
       | 
         ETC_CSV 
         | 
         use CSV format. When reading all entities are returned as textual strings
         |  
       | 
         ETC_TYPEDCSV 
         | 
         use CSV format. When reading the parser tries to identify integers, reals or booleans from unquoted strings
         |  
       | 
         ETC_SKIPH 
         | 
         skip first line (header) of the file
         |  
       | 
         ETC_AUTONDX 
         | 
         similar to sparse format but indices are not read or written (only applies to 1-dimension arrays indiced by ranges)
         |  
       | 
         ETC_EMPTYNDX 
         | 
         missing indices are replaced by a default value
         |  
       | 
         ETC_DATAFRAME 
         | 
         dense data format for a 2-dimension array and first index as a range (for the line numbers)
         |  
     Several options may be combined using `
     +'.
     | 
  
   | 
     file 
     | 
     Extended file name
     | 
  
   | 
     a 
     | 
     Array to export or initialize
     | 
  
   | 
     s 
     | 
     Set to export or initialize
     | 
  
   | 
     l 
     | 
     List to export or initialize
     | 
 
 
  Example
 
 
 The following example declares two sets and two dynamic arrays. The array
 ar1 is read in from the file
 in.dat. Then both arrays,
 ar1 and
 ar2, are saved to the file
 out.dat (in sparse format) and finally the contents of the set
 Set1 is appended to the file
 out.dat.
 
 
 declarations
 Set1: set of string
 R: range
 ar1,ar2: array(Set1,R) of real
end-declarations
diskdata(ETC_SPARSE, "in.dat", ar1)
diskdata(ETC_OUT, "out.dat", [ar1, ar2])
diskdata(ETC_OUT+ETC_APPEND, "out.dat", Set1)
  
  Further information
 
 
 1. This procedure reads in data from a file or writes to a file, depending on the parameter settings. The file format used is compatible with the command DISKDATA of the modeler mp-model (unless the option
 ETC_CSV is specified).
 
 
 2. Only arrays lists and sets of basic and native types (including
 mpvar and
 linctr for writing) can be used with this procedure, in particular records are not supported.
 
 
 3. If option
 "dataframe" is combined with
 "skiph" the array to be processed must be indiced by a range and a set of strings. The second index is automatically populated with the column names of the header row when reading (the same line is generated when writing).
 
 
 4. Options
 ETC_SGLQ,
 ETC_NOQ,
 ETC_CSV and
 ETC_TYPEDCSV are mutually exclusive and connot be combined.
 
 
 5. In case of error the procedure raises an IO error.
 
 
  Module
 
 
                 
                
                    © 2001-2023 Fair Isaac Corporation. All rights reserved. This documentation is the
                    property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not
                    convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except
                    solely for internal evaluation purposes to determine whether to purchase a license to the software
                    described in this documentation, or as otherwise set forth in a written software license agreement
                    between you and FICO (or a FICO affiliate). Use of this documentation and the software described in
                    it must conform strictly to the foregoing permitted uses, and no other use is permitted.