Prev Up Next Index
Go backward to 9.1 newform
Go up to 9 Format Conversion
Go forward to 9.3 readfile

9.2 chkform

 

Though newform is useful for checking data formats, it is limited by requiring a format file to specify an output format. Since some FreeForm ND applications (such as the OPeNDAP FreeForm handler) do not require an output format, this is extra work for the dataset administrator. For these occasions, FreeForm ND provides a simpler format-checking program, called chkform.

The chkform program attempts to read an ASCII file, using the specified input format. If the format allows the file to be read properly, chkform says so. However, if the input format contains errors, or does not accurately reflect the contents of the given data file, chkform delivers an error message, and attempts to provide a rudimentary diagnosis of the problem.

You must create a format description file (or files) with format descriptions for the data files involved before you can use chkform to chack the format. As with newform, the standard extension for format description files is .fmt. If you do not explicitly specify the format description file on the command line (unnecessary if you use FreeForm ND naming conventions) chkform follows the FreeForm ND search sequence to find a format file.

For details about FreeForm ND naming conventions and the search sequence, see Chapter 8.

The chkform command has the following form:

chkform input_file [-if input_format_file] [-ift "title"] [-b local_buffer_size]

[-c count] [-q query_file] [-ol log_file] [-el error_log_file] [-ep]

Most of the arguments are described in Section 8.6. The following are specific to chkform:

-ol log_file
Puts a log of processing information into the specified log_file.
-el error_log_file
Creates an error log file that contains whatever error messages are issued by chkform.
-ep
In normal operation, chkform asks you to manually acknowledge each important error by typing something on the keyboard. If you use this option, chkform will not stop to prompt, but will continue processing until either the file is procesed, or there is an error preventing more processing.

As in the above examples, if you have an ASCII data file called datafile.dat, supposedly described in a format file called datafile.fmt, you can use chkform like this:

chkform datafile.dat

If processing is successful, you will see something like the following:

Welcome to Chkform release 4.2.3 -- an NGDC FreeForm ND application


(llmaxmin.fmt) ASCII_input_file_header  "Latitude/Longitude Limits"
File llmaxmin.dat contains 1 header record (71 bytes)
Each record contains 6 fields and is 71 characters long.

(llmaxmin.fmt) ASCII_input_data "lat/lon"
File llmaxmin.dat contains 10 data records (230 bytes)
Each record contains 3 fields and is 23 characters long.

100% processed     Elapsed time - 00:00:00

No errors found (11 lines checked)

Tom Sgouros and James Gallagher, 2006-02-12

Prev Up Next