IMPORT (not included in filePro Lite)

 

Syntax:


       Then: import ASCII filename R=r F=f O=o C=c

       Then: import DIF filename
       Then: import WORD filename

 

DIF, WORD, ASCII are the type of file from which IMPORT will draw data.
filename is the source filename.
filename can be an expression by assigning it as an alias as in:

 

        Then: import ASCII aaa=(exp) R=r F=f O=o C=c

 

Version Ref:  3.x

 

Description:

IMPORT opens a non-filePro file so that its data can be accessed by filePro. Typically, records from an imported file are copied into records of a filePro file. The data can be copied (on a field by field basis) into existing records or into free records.

 

IMPORT can work with three types of file formats: ASCII for reading text and word processing files, DIF for reading "dif" style files, and WORD for reading WordStar text files.

 

ASCII:

       Then: import ASCII name R=r F=f O=o C=c

or:

       Then: import ASCII name=pathname R=r F=f O=o C=c

 

where "name" is the name of the import file and "pathname" is a full or relative pathname. Use the pathname option when the merge file is not in the current directory.

 

"r" is record separator
"f" is field separator
"o" is opening field delimiter
"c" is closing field delimiter.

 

Example:

 Then: IMPORT ASCII test=test.txt R=^J f=\^

 

The above would import a file named "test.txt" in your current directory containing a "linefeed" character at the end of each record with a "^" between each data field. Notice the different use of " ^ " symbol. In the first case it is used as a control character to read a "linefeed" and in the second case it reads a literal " ^ " since it is preceeded with a " \ " backslash. Also notice that the "O" Opening and "C" Closing field delimiters are not used in the above example.

 

IMPORTING CSV formats - Opening and closing field delimiters are commonly used in "CSV" type files.

 

Example:

 

Typical CSV formatted file

 

"John","Adams","123 South Street","Anywhere","NY"

"Quincy","Smith", 100 North Street", "Washington","PA"

"Debby", "Adams","123 State Hwy 7","Mount Vernon","VA"

 

This data format is usually imported using the IMPORT WORD but can also be imported using IMPORT ASCII by identifying quotes as the opening and closing field delimiters as follows.

 

 Then IMPORT ASCII tst=c:\temp\test.txt R=^J f=, O=" C="

 

IMPORTANT: You may use a few special codes with the IMPORT ASCII format to identify delimiters or field separators:

\r for carriage return
\f for form feed
\n for new line
\t for tab

 

You may also use punctuation characters, ASCII codes, and control codes if your import file contains these as delimiters and separators.

 

The CARET " ^ " symbol - This symbol requires special treatment since it indicates a "CTRL" character and is normally followed by a letter e.g. ^J, ^L, ^M, etc. Refer to the "Character Table" in "Define Processing" help for "CTRL" characters. In cases where you want to import the caret "^" symbol as a literal, preceed it with a backslash e.g. \^.

 

DlF:

       Then: import DIF name

or:

       Then: import DIF name=pathname

 

where "name" is the name of the import file and "pathname" is a full or relative pathname. Use the pathname option when the merge file is not in the current directory.

 

WORD:

 

       Then: import WORD name

or:

       Then: import WORD name=pathname

 

where "name" is the name of the import file and "pathname" is a full or relative pathname. Use the pathname option when the merge file is not in the current directory.

 

Each "IMPORT filename" definition must be alone on its "Then" line.

Field assignments are written after the IMPORT command has been executed.

Use at least three characters for the IMPORT filename, and don't start with a number.

IMPORT is not available on Automatic or Input processing.

When using a pathname for the IMPORT filename, use the separator mark (\ or /) appropriate to your operating system.

 

Restrictions:

An "IMPORT filename" definition must be alone on its "Then" line.

 

Only one EXPORT or IMPORT statement with the same filename is allowed per processing table. In other words, you can't have the statement, "EXPORT MULTI List" followed in a few elements by "IMPORT WORD List."