Release 10.1A: OpenEdge Development:
Programming Interfaces

> ## Converting nonstandard input files

> The input files used in the previous examples contained data that was in a very specific format:

> i-datf1.d
>     90 "Wind Chill Hockey" BBB
>     91 "Low Key Checkers"  DKP
>     92 "Bing’s Ping Pong"  SLS

> When using a data file as an input source, Progress, 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.

> Progress provides two strategies for dealing with such files:

> - Use the `QUOTER` utility to convert the file to the standard Progress format. You can then use the normal Progress 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 want this validation and in others you might not want it.

> - 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 Appendix E "Command and Utility Reference."

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095