Try OpenEdge Now
skip to main content
Programming Interfaces
Input/Output Processes : Alternate I/O Sources : Converting nonstandard input files
 

Converting nonstandard input files

The input files used in previous examples contained data that was in a very specific format. For example, see Input from files .
When using a data file as an input source, the AVM, by default, expects that file to conform to the following standards:
*One or more spaces must separate each field value.
*Character fields that contain embedded blanks must be surrounded by quotes (" ").
*Any quotes in the data must be represented by two quotes (" ").
What if you need to deal with an input file that does not conform to these standards? For example, you might have a file in which each field is on a separate line; or where fields are separated by commas instead of spaces; or where the fields have no special delimiters, but appear at specific column locations.
ABL provides two strategies for dealing with such files:
*Use the QUOTER utility to convert the file to the standard ABL format. You can then use the normal ABL frame-based input statements, such as SET, to read data from the file.
*Use the IMPORT statement to read from the file.
Which method you choose depends on your particular circumstances. For example:
*The frame-based statements, such as SET, validate the format of the incoming data; IMPORT does not. In some cases you might want this validation and in others you might not.
*If you expect to read the same file repeatedly, preprocessing that file once with QUOTER might be worthwhile. However, if your code reads from different files, or the content of the file is subject to change, you might want to avoid repeated preprocessing by using IMPORT instead.
The following section explains how to use the IMPORT statement. For information about the QUOTER utility, see Commandand Utility Reference.
* Importing and exporting data