DC_READ_FREE Function

Reads freely-formatted ASCII files.

Usage

Input Parameters

Output Parameters

Returned Value

Keywords

$BLANK_LINES Skip all blank lines; this prevents those lines from being interpreted as a series of zeroes.
$TEXT_IN_NUMERIC Skip any line where text is found in a numeric field.
$BAD_DATE_TIME Skip any line where invalid date/time data is found.

Discussion


NOTE: This function can be used to read data into date/time structures, but not into any other kind of structures.

String Resources Used By This Function

How the Data is Transferred into Variables


NOTE: If the file contains string data, make sure the strings do not contain delimiter characters. Otherwise, the string will be interpreted as more than one string, and the data in the file will not match the variable list.

TIP: If an error does occur, use the PRINT command to view the contents of the variables to see where the last successfully read value occurs. This will enable you to isolate the portion of the file in which the error occurred.

Physical Records vs. Logical Records


NOTE: The Nrecs keyword counts by logical records, if they have been defined. The Nskip keyword, on the other hand, counts by physical records, regardless of any logical record size that has been defined.

Changing the Logical Record Size


NOTE: By default, DC_READ_FREE considers the physical record to be one line in the file, and the concept of a logical record is not needed. But if you are using logical records, the physical records in the file must all contain the same number of values. The Vals_Per_Rec keyword can be used only with column-oriented data files.

Filtering and Substitution While Reading Data


TIP: Be sure not to filter characters that were used in the file as delimiters. The delimiters enable DC_READ_FREE to discern where one data value ends and another one begins.

NOTE: If you want to supply multi-character strings instead of individual characters, you can do this with the Ignore keyword. However, keep in mind that a character that matches Filters is simply discarded, and filtering resumes from that point, while a string that matches Ignore causes that entire line to be skipped.

Missing Data Substitution

Delimiters in the Input File


NOTE: Use a different delimiter to separate data values in the file than you use to separate the different fields of dates and times, such as months, days, hours, and minutes. Otherwise, your date/time data may not be interpreted correctly. The only delimiters that can be used inside date/time data are: slash ( / ), colon (:), hyphen (-), and comma (,).

Reading Row-Oriented Files

Reading Column-Oriented Files

Example 1

Example 2


NOTE: If the Resize = [2] keyword had been provided, var2 would have been resizable and would have ended up having many more elements. Specifically, var2 would have ended up with 57 elements instead of just 5.

Example 3

Example 4

Example 5

Number Template Description
1 MM*DD*YY (* = any delimiter)
-1 HH*MM*SS (* = any delimiter)





TIP: Another alternative to view the contents of date1 and float1 is to use the DT_PRINT command instead of PRINT.

NOTE: Because of the internal conversion that DC_READ_FIXED performs to convert the date strings to PV-WAVE's date/time internal structure, the date and time data must be read with the A8 (FORTRAN) or %8s (C) format string.

See Also





doc@boulder.vni.com
Copyright © 1999, Visual Numerics, Inc. All rights reserved.