The
writecase function writes a case from memory to an external data file. It can be used to update existing cases or to write new ones.
The dictionary_name must be supplied and refers to an external dictionary associated with your application.
After a case is written to an external file, the dictionary variables for that case remain in memory. If the application does not assign new values to all variables in the external dictionary before the next
writecase function is executed, then the values from the previous case will be written to the external data file. Use the
clear function to reset the values of these variables.
In a batch application it is possible to have the function output cases without updating the file's index. This allows the external data file to have duplicate cases, i.e., cases sharing the same set of IDs. This may be useful if the batch application is a tool to reformat large sets of data, a situation in which maintaining the file's index is very time consuming. Since no check is done for duplicates you should be certain that duplicates cannot be generated, or that you want duplicates in the data file. You cannot use other external file functions like
loadcase or
retrieve if using no index mode. To use this special mode, in the function arguments write (noindex) after the dictionary name.
The function returns a logical value of 1 (true) if the write is successful and 0 (false) otherwise.