EXPORT - FastExport

Teradata FastExport Reference

Product
FastExport
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2410
lifecycle
previous
Product Category
Teradata Tools and Utilities

The EXPORT command provides the client system destination and file format specifications for the export data retrieved from Teradata Database and, optionally, generates a MultiLoad script file that can be used to reload the export data.

where:

 

Syntax Element

Description

OUTFILE fileid

Data destination file on the client system.

The client system DD or equivalent statement specifies a file:

  • In UNIX OS and Windows, the fileid is the path name for a file.
  • If the path name has embedded white space characters, the entire 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.

  • In z/OS, the fileid is a DDNAME.
  • AXSMOD name

    Name of the access module file to be used to export data. These access modules include:

  • OLE DB Access Module (oledb_axsmod.dll on Windows platforms)
  • Named Pipes Access Module
  • Teradata WebSphere® MQ Access Module (client version)
  • Teradata WebSphere® MQ Access Module (server version)
  • See the Teradata Tools and Utilities Access Module Reference (B035‑2425) for the name of the access module file for each platform.

    A personal shared library file name can be used if custom access module is used.

    The AXSMOD option is not required for importing disk files on either network‑attached or mainframe‑attached client systems, or magnetic tape files on mainframe‑attached client systems. It is required for importing magnetic tape and other types of files on network‑attached client systems.

    To specify the OLE DB Access Module, Named Pipes Access Module, or the WebSphere MQ Access Module for specific platforms, see Teradata Tools and Utilities Access Module Reference.

    ’initstring’

    [Optional] initialization string for the access module

    OUTMOD modulename

    [Optional] user‑written routine for processing the export data.

    In z/OS, modulename is the name of a load module. On UNIX and Windows platforms, it is the path name of the OUTMOD executable code file.

    FastExport provides six parameters to the named procedure, as described in “FastExport/OUTMOD Routine Interface” on page 45.

    Note: On some versions of UNIX operating systems, ./ prefix characters may have to be added to the OUTMOD modulename specification if the module is in the current directory.

    MODE…

    Format mode of the export data returned to the client system:

  • INDICATOR
  • RECORD
  • The default, if a MODE option is not specified, is INDICATOR mode.

    Note: FastExport does not support field mode. To export field mode data, use the appropriate format clauses in the SELECT statements to enable Teradata Database to convert response data to character format.

    FORMAT…

    Record format of the export file on network‑attached systems where:

  • FASTLOAD specifies that each record is a two‑byte integer, n, followed by n bytes of data, followed by an end‑of‑record marker, either X'0A' or X'0D'.
  • BINARY specifies that each record is a two‑byte integer, n, followed by n bytes of data.
  • TEXT specifies that each record consists of an arbitrary number of characters in the client session character set, followed by an end‑of‑record marker, which is:
  • On UNIX platforms, the newline character (identified in Unicode as LINE FEED U+000A)
  • On Windows platforms, the two‑character sequence carriage return followed by line feed (identified in Unicode as CARRIAGE RETURN U+000D and LINE FEED U+000A, respectively)
  • For client session character sets other than UTF16, the end‑of‑record marker byte sequence is:

  • On UNIX platforms, X'0A'
  • On Windows platforms, X'0D0A'
  • For the UTF16 client session character set (in which each character is encoded in two bytes), the end‑of‑record marker byte sequence is:

  • On big endian UNIX platforms, X'000A'
  • On little endian UNIX platforms, X'0A00'
  • On Windows platforms, X'0D000A00'
  • Note: TEXT format should only be specified for character data. Do not specify TEXT format for binary data, such as, INTEGER, BYTEINT, PERIOD, and other binary data. Depending on the actual byte values of the binary data, unexpected results may occur.

  • UNFORMAT specifies that each record is exported as it is received from CLIv2 without any client modifications.
  • Note: The FORMAT options apply only to UNIX and Windows platforms.

    The default, if a FORMAT option is not specified, is FASTLOAD.

    Note: INDICATOR mode is not recommended when using TEXT record format. Please use UNFORMATTED record format instead.

    Note: TEXT data requires all CHAR or ANSIDATE data types.

    BLOCKSIZE integer

    Maximum block size that should be used when returning data to the client

    The default block size is 64K bytes, which is the maximum supported by Teradata Database.

    Note: The BLOCKSIZE specification for a FastExport EXPORT command cannot be larger than the row size supported by Teradata Database.

    OUTLIMIT records

    Maximum number of response records that should be written to the output client file

    When this number is reached, the utility writes the following message to the print output file and stops processing response data:

       Output limit of n exceeded. 

    MLSCRIPT fileid

    Destination file of the generated MultiLoad script file

    When the MLSCRIPT option is specified, FastExport generates a MultiLoad script file that can later be used to reload the export data back into Teradata Database.

    The client system DD or equivalent statement specifies a file:

  • In UNIX OS and Windows, the fileid is the pathname for a file
  • In z/OS, the fileid is a DDNAME.
  • By default, if the MLSCRIPT option is not specified, then the FastExport utility does not generate a MultiLoad script file.

    Note: If the specified fileid already exists, it will be overwritten.

    Note: FastExport generates the MultiLoad script layout based on field sizes and types received from the Teradata Database. Type DATE must be modified to CHAR () type as in the case of using ANSIDATE in the DATEFORM command. They must then be converted to the fixed length CHAR data type as though writing a script to load the data.

    If Extended Object Name is used in Teradata FastExport, the resulting MultiLoad script file generated will not have column names in U& syntax. The user should add the U& syntax for multiload job to run successfully.
    For example, Teradata FastExport uses a column as U&"c1#FF43#FF11"UESCAPE'#',
    The resulting multiload script is:

    In order for Teradata MultiLoad to work properly, you must change c1c1 to U&"c1#FF43#FF11"UESCAPE'#'.

    			.LAYOUT DATAIN_LAYOUT INDICATORS;
    			.FIELD c1c1 1 INTEGER;
    			.FIELD c2 5 CHAR(20);
     
    			.DML LABEL INSERT_DML;
    			INSERT INTO &DBASE_TARGETTABLE..&TARGETTABLE (
    			 c1c1 = :c1c1
    			,c2 = :c2
    			);

    PAD

    The padding feature is only available on the Z/OS platform.

    PAD can have two values, NULLS and BLANKS. Records are padded with NULLS When NULLS is specified. Records are padded with BLANKS when BLANKS is specified.

    The default value is BLANKS.

    Table 30 describes the things to consider when using the EXPORT command.

     

    Table 30: EXPORT Command Usage Notes 

    Topic

    Usage Notes

    Attributes of the Destination File

    On mainframe‑attached client systems, the attributes of the destination file must be compatible with the export data records that will be written there. (Compatibility is not a problem on network‑attached UNIX and Windows client systems.)

    On mainframe‑attached z/OS systems, the attributes vary, depending on:

  • Disposition of the file – If the execution of the FastExport utility is a restart operation, then the disposition of the destination file should be OLD
  • Response mode – For all response modes, the attributes can specify any RECFM. However, RECFM=FB (fixed blocked) or RECFM=VB (variable blocked) are commonly used.
  • Record length and block size – These must accommodate the specified format as shown in Table 31
  • Teradata Database data types in the mainframe‑attached z/OS environments are described in Table 32. Use this information to calculate the size of the exported data rows to assign appropriate values to the attributes of the destination file.

    Block Size Specification

    Two 64K‑byte buffers are allocated for each session being used to transmit data from Teradata Database to the client system.

    The minimum block size that must be allocated is one which will hold the largest possible parcel returned by Teradata Database.

    If the specified block size is not large enough to hold the largest possible parcel, Teradata Database returns an error to the SELECT statement and the utility is abnormally terminated.

    For a complete description of the parcel sizes, see:

  • Teradata Call-Level Interface Version 2 Reference for Mainframe-Attached Systems (B035‑2417)
  • Teradata Call-Level Interface Version 2 Reference for Network-Attached Systems (B035‑2418)
  • Command Placement and Frequency

    One EXPORT command is required for each export task in a FastExport job script. Place it anywhere between the BEGIN EXPORT command and the END EXPORT command that specify the export task.

    MODE Specifications

    Both the INDICATOR and RECORD mode specifications return data in a client internal format with variable‑length records:

  • Each record has a value for all of the columns specified by the SELECT statement
  • Variable‑length columns are preceded by a two‑byte control value indicating the length of the column data
  • Null columns have a value that is appropriate for the column data type
  • Data records returned in indicator mode, however, have a set of bit flags that identify the columns that have a null value.

    For a complete description of these modes, see:

  • Teradata Call-Level Interface Version 2 Reference for Mainframe-Attached Systems (B035‑2417)
  • Teradata Call-Level Interface Version 2 Reference for Network-Attached Systems (B035‑2418)
  • Multiple SELECT Statements

    If the export task specified multiple SELECT statements, the export data is returned in statement order. All response data for statement 1 is followed by the response data for statement 2, and so forth.

    If the same SELECT statement is executed multiple times, then the results of the first iteration are returned and processed before the second iteration of the SELECT statement is sent to Teradata Database.

    SELECT Statement Processing

    If the export task specified multiple SELECT statements, the response data for all statements is returned in statement order – all response data for statement 1 will be first, followed by the data for statement 2, and so forth.

    If a single SELECT statement is executed multiple times, the results of the first iteration are returned and processed before the second SELECT statement is sent to Teradata Database.

    z/OS fileid Usage Rules

    A DDNAME must obey the same construction rules as Teradata SQL column names except that:

  • The "at" character (@) is allowed as an alphabetic character
  • The underscore character (_) is not allowed
  • The DDNAME must obey the applicable rules of the external system and may reference a sequential or VSAM data set 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.

    Table 31 describes the Record Length and Block Size Specification.

     

    Table 31: Record Length and Block Size Specifications 

    RECFM

    Description

    FB

    LRECL must be exactly equal to the number of bytes of data being returned. The LRECL cannot be larger.

    For RECFM=FB, the BLKSIZE must also be a multiple of the LRECL. If not, records may be truncated, resulting in possible data integrity problems, or FastExport may append.

    Explicitly adding BLKSIZE to the JCL eliminates the possibility of using an invalid default BLKSIZE.

    VB

    Logical record length (LRECL) and block size (BLKSIZE) parameters should be large enough to accommodate the largest record that is anticipated.

    VBS or VS

    Maximum logical record length can exceed the physical length for a given data set.

    Spanned records, either blocked or unblocked, use a well‑established straightforward protocol to break or segment records across blocks where necessary.

    While an individual segment never exceeds the length of a block, the logical record that it is a part of can span multiple blocks, and even volumes. Thus spanned records are the only way to create output files with rows whose length exceed the 32K‑byte block size, up to the maximum of 64K bytes that is supported by Teradata Database.

    Even though the maximum LRECL that can be specified with JCL is 32,760, there is no practical limit on the actual length of spanned records.

    For output consisting of records exceeding this maximum LRECL (greater than approximately 32K, for example), simply specify LRECL=X. There is no other special JCL requirement for creating such records when using the VBS or VS record format.

    Always specify the BLKSIZE according to the performance characteristics of the target device or media. This usually means specifying the largest possible BLKSIZE.

    In some cases, the performance of the FastExport utility may be improved by specifying RECFM=VBS when:

  • The largest row is appreciably smaller than 32K bytes in length
  • There is a large variation in row sizes
  • The spanned/blocked format maximizes data packing. Because fewer blocks are required to convey the same number of logical records, the FastExport job runs quicker.

     

    For example, assuming a block size of 32,756 bytes:

  • Using RECFM=VB, a 20,000‑byte record and a 4,000‑byte record could be packed into a newly created block. But, if the next record were 12,000 bytes long it clearly would exceed the length of the block and would have to be packed into the following block.
  • Using RECFM=VBS, the 12,000‑byte record could be segmented such that the first 8,740 bytes could be packed into the original block and the remaining 3,260 bytes packed into the subsequent block, taking into account that there must be one 4‑byte Block Descriptor Word (BDW) per block and one 4‑byte Segment Descriptor Word (SDW) per segment; and a segment must be fully contained within a block
  • Note: A FastExport job will fail with an Error 1776 if rows greater than 32K bytes are exported using a RECFM= specification other than VBS or VS.

    Note also that not all applications can read spanned data records. Always make sure that applications support spanned records before specifying these formats.

    Example: This DD statement requests spanned records for a FastExport EXPORT to fileid named OUTPUT:

    //OUTPUT  DD DSN=ASG.FEXP.Z,DISP=(NEW,CATLG),
    //     DCB=(RECFM=VBS,LRECL=32760,BLKSIZE=32756,DSORG=PS),
    //     UNIT=SYSDA,SPACE=(CYL,(100,20)) 

    Table 32 contains the Data Type description for default MainframeAttached Client Systems.

     

    Table 32: Data Type Descriptions (MainframeAttached Client Systems) 

    Data Type

    Output Length

    Description

    BYTE(n)

    n bytes

    n bytes

    BYTEINT

    1 byte

    8‑bit signed binary

    CHAR(n)

    CHARS(n)

    CHARACTERS(n)

    n bytes

    n EBCDIC characters

    DATE

    4 bytes

    32‑bit integer in the internal date format of Teradata Database.

    For details, see Database Design (B035‑1094) and SQL Data Types and Literals (B035‑1143).

    Note: If a DATEFORM command has been used to specify ANSIDATE as the DATE data type, the FastExport utility internally converts each DATE data type to a CHAR(10) field.

    DECIMALx

    DECIMAL(x)

    DECIMAL(x,y)

    (x+1) / 2 bytes

    x packed decimaldigits and sign

    FLOAT

    FLOATING

    8 bytes

    64‑bit (double‑precision) floating point

    GEOSPATIAL DATA

    maximum 64000

    FastExport does not support Geospatial data represented by LOBs.

    INTEGER

    4 bytes

    32‑bit signed binary

    LONG VARCHAR

    m+2 characters where m<=n

    Same as VARCHAR (32000) characters

    Fixed Length Period Data Types:

    PERIOD(DATE)

    PERIOD(TIME(n))

    PERIOD(TIME(n) WITH TIME ZONE)


    max=8 byte

    max=12 bytes

    max=16 bytes

    The precision specified must be 0<n<6:
    precision=0 (n/a)

    precision=n

    precision=n

    For details, see Database Design (B035‑1094) and SQL Data Types and Literals (B035‑1143).

    Variable Length Period Data Types:

    PERIOD(TIMESTAMP(n))

    PERIOD(TIMESTAMP(n) WITH TIME ZONE)

     

    max=20 bytes

    max=24 bytes

    The precision specified must be 0<n<6:

    precision=n

    precision=n

    For details, see Database Design (B035‑1094) and SQL Data Types and Literals (B035‑1193).

    SMALLINT

    2 bytes

    16‑bit signed binary

    VARBYTE(n)

    m+2 bytes where m<=n

    16‑bit integer, count m, followed by m bytes of data

    VARCHAR(n)

    m+2 bytes where m<=n

    16‑bit integer, count m, followed by m EBCDIC characters

    Refer to SQL Data Types and Literals (B035‑1143) for more information.

    The following example specifies that the exported records to be loaded are written to /home/fexpuser/tests/out1 and that the format of each record is unformat:

    .EXPORT OUTFILE /home/fexpuser/tests/out1
    FORMAT UNFORMAT ;

    The following example for a UNIX client system runs an OUTMOD routine that has been compiled and linked as feomod.so:

    .EXPORT OUTMOD ./feomod.so;

    The following example for a Windows client system runs the same OUTMOD routine that has been compiled and linked as feomod.dll:

    .EXPORT OUTMOD .\feomod.dll;