The IMPORT command defines the client file that provides the USING data values for the FastExport SELECT statement.
The IMPORT command syntax depends on whether the FastExport utility is running on a mainframe‑attached or network‑attached client system. Several of the syntax elements are common to both configurations, while others are specific to each.
For Mainframe‑Attached Client Systems
For Network‑Attached Client Systems
where:
Syntax Element |
Description |
INFILE fileid |
Input file on the client system The client system DD or equivalent statement specifies a file: If the path name has embedded white space characters, the path name must be enclosed in single or double quotes. If the path name is enclosed by single quotation marks and there is an embedded single quotation mark, then an escape character (single quotation mark) needs to precede the embedded single quotation mark. Likewise, if the path name is enclosed by double quotation marks and there is an embedded double quotation mark, then an escape character (double quotation mark) needs to precede the embedded double quotation mark. If the path name contains single or double quotation marks, it should be enclosed in either single or double quotation marks. |
AXSMOD name |
Name of the access module file to be used to import data: See the Teradata Tools and Utilities Access Module Reference (B035‑2425) for the name of the access module file for each platform. A shared library file name can be used if a custom access module exists. The AXSMOD option is not required for importing from: It is required for importing from magnetic tape and other types of files on network‑attached client systems. For more information about specific Teradata access modules, see the Teradata Tools and Utilities Access Module Reference (B035‑2425). |
init‑string |
Optional initialization string for the access module The initialization string can contain double quotes, but not single quotes. |
INMOD modulename |
Optional user‑written routine for preprocessing the input data In z/OS, modulename is the name of a load module. On UNIX and Windows client systems, it is the pathname for the INMOD executable code file. When both the INFILE fileid and the INMOD modulename parameters are specified, FastExport reads the input file and passes the data to the INMOD routine for preprocessing. If the INFILE fileid parameter is not specified, FastExport expects the INMOD routine to provide the input data record. FastExport provides two parameters to the named routine, as described in “FastExport/INMOD Routine Interface” on page 44. Note: On some versions of UNIX operating systems, ./ prefix characters may have to be added to the INMOD modulename specification if the module is in the current directory. Note: If INMOD module output messages to stdout, the character set that INMOD uses is independent of the character set that Teradata FastExport uses; the display on stdout can be of mixed character sets. For example, IMMOD can output messages in ASCII and Teradata FastExport can output messages in UTF‑16. |
USING (parms) |
Character string containing parameters can be passed to the INMOD routine: Note: The parms string must be FDLINMOD for INMOD routines written for the prior Pascal version of FastLoad (program FASTMAIN). |
FORMAT… |
Record format of the input file, where: Note: TEXT format does not support numeric data. Do not specify TEXT if the MLSCRIPT option of an EXPORT command is also used. Note: All above FORMAT options apply to UNIX and Windows platforms. The VARTEXT option applies to mainframe. The default FORMAT option for UNIX and Windows platforms is FASTLOAD. The default FORMAT for mainframe is “use record boundaries “, meaning the input data is read record‑by‑record and the LAYOUT is applied to each record. |
‘c’ |
Optional specification of the delimiter that separates fields in the variable‑length text records of the input data source The delimiter can be a single or multi‑character sequence (or string). If the delimiter is not specified, the default is the character sequence consists of a single pipe character (|). If the script character set is different from the client session character set, the delimiter is converted from the script character set to the client session character set before it is passed to Data Connector. Note: Any character sequence that appears in the data cannot be used as a delimiter. No control character other than a tab character can be used in a delimiter. |
DISPLAY ERRORS |
[Optional] Keyword specification that writes input data records that produce errors to the standard error file |
NOSTOP |
[Optional] Keyword specification that inhibits the FastExport termination in response to an error condition associated with a variable‑length text record |
LAYOUT layoutname |
Identifier of the file layout description, as specified by a prior LAYOUT command |
EFILE <efilename> |
Optional keyword specification that writes input data records that produce errors to the user specified error file. If the user doesn't specify the error file name, the default error destination is the standard error file. |
TRIM |
Optional keyword. It is used to specify whether field values in variable‑length text record could be trimmed. It must be followed by one of the following keywords: NONE, LEADING, TRAILING or BOTH. |
NONE |
Can follow the keyword TRIM. It is used to specify that field values are not to be trimmed. TRIM NONE is the default behavior of the trim processing which is the same as not specified the TRIM at all. |
LEADING |
Can follow the keyword TRIM. It is used to specify the leading characters of field values must be trimmed. See 'p' below for trim character specification. |
TRAILING |
Can follow keyword TRIM. It is used to specify that the trailing characters of field values must be trimmed. See 'p' below for trim character specification. |
BOTH |
Can follow keyword TRIM. It is used to specify that the leading and trailing characters of field values must be trimmed. See 'p' below for trim character specification. |
'p' |
Optional specification of the trim character in field values of variable‑length text records of the input data source. It is specified after the keyword LEADING, TRAILING or BOTH. Rules for a trim character are: |
QUOTE |
Optional keyword. It is used to specify whether field values in variable‑length text record will never be quoted (if it is followed by keyword NO), optionally be quoted (if it is followed by keyword OPTIONAL) or always be quoted (if it is followed by keyword YES). It must be followed by one of the following keywords: NO, OPTIONAL or YES. |
NO |
Can follow keyword QUOTE. It is used to specify that field values will never be quoted. It is the default behavior. |
OPTIONAL |
Can follow keyword QUOTE. It is used to specify that field values will optionally be quoted. |
YES |
Can follow keyword QUOTE. It is used to specify that field values will always be quoted. |
'q' |
Optional specification of the opening quoted character in field values of variable‑length text records of the input data source. See 'r' for more information. |
'r' |
Optional specification of the closing quoted character in field values of variable‑length text records of the input data source. Rules for opening and closing quoted characters are: |
Table 37 describes the things to consider when using the IMPORT command.
Topic |
Usage Notes |
Command Frequency and Placement |
If the export task uses a LAYOUT command, then an IMPORT command is required, and it must appear after the LAYOUT command. |
Data Type Specifications |
When using the VARTEXT specification, VARCHAR, VARBYTE, and LONG VARCHAR are the only valid data type specifications which can be used in the FastExport layout FIELD command and FILLER command. For additional information on data types, see Table 32 on page 82. |
Error Record Handling |
When FastExport encounters an error condition in an input record, it normally discards the record and terminates. In loading variable‑length text records, either or both of these functions can be inhibited by specifying the options: By specifying both options and redirecting STDERR to a file location instead of the terminal screen, the FastExport job will run to completion and save all the error records. Then it can be manually modify and loaded. |
Input Record Requirements |
The total number of fields in each input record must be equal to or greater than the number of fields described in the FastExport layout FIELD command and FILLER command. If it is less, FastExport generates an error message. If it is more, Teradata Database ignores the extra fields. The last field of a record does not have to end with a delimiter character. It can end with a delimiter character, but it is not required. |
Multiple Physical Records |
If the FastExport task reads the input file and constructs a logical record from multiple physical records, this is performed before the physical record is passed to the INMOD routine. The INMOD routine is invoked only one time for the generation of each USING record. |
Null Fields |
Two consecutive delimiter characters direct FastExport to null the field corresponding to the one right after the first delimiter character. Also, if the last character in a record is a delimiter character, and there is at least one more field to be processed, then FastExport nulls the field corresponding to the next one to be processed, as defined in the layout FIELD command and FILLER command. |
VARTEXT Records |
When VARTEXT is specified, FastExport assumes that the input data is variable‑length text fields separated by a field‑delimiter character. The utility parses each input data record on a field‑by‑field basis, and creates a VARCHAR field for each input text field. |
z/OS fileid Usage Rules |
A DDNAME must obey the same construction rules as Teradata SQL column names except that: The DDNAME must obey the applicable rules of the external system and may reference a sequential or VSAM data set. If the DDNAME represents a data source on magnetic tape, the tape may be either labeled or nonlabeled, as supported by the operating system. |
This example specifies that the using data for the SELECT statement is contained in /home/fexpuser/tests/data1 and that the format of each record is binary.
.IMPORT INFILE /home/fexpuser/tests/data1
FORMAT BINARY
Layout layl;
The following example for a UNIX client system runs an INMOD routine that has been compiled and linked as feimod.so:
.IMPORT INMOD ./feimod.so LAYOUT lay1;
The following example for a Windows client system runs the same INMOD routine that has been compiled and linked as feimod.dll:
.IMPORT INMOD ./feimod.dll LAYOUT lay1;