Does anyone have an example of a TPT script with format = text?
I'm trying to load a file with variable length records into a table with a single varchar(1000) column. I tried basing the script on the qstart1 example and just changing 'delimited' to 'text', but I get an error:
$FILE_READER[1]: TPT19108 Data Format 'TEXT' requires all 'CHAR/ANSIDATE' schema
The variables script (excluding connection info) is:
---------
,DDLPrivateLogName = 'ddlprivate.log'
,LoadPrivateLogName = 'loadprivate.log'
,TargetErrorList = ['3807']
,WorkingDatabase = 'dev_sandpit'
,TargetWorkingDatabase = 'dev_sandpit'
,TargetTable = 'RAW_CODA_LOAD'
,LogTable = 'RAW_CODA_LOAD_LOG'
,ErrorTable1 = 'RAW_CODA_LOAD_E1'
,ErrorTable2 = 'RAW_CODA_LOAD_E2'
,SourceFileName = 'coda_mil2.692130.txt'
,SourceFormat = 'text'
,OpenMode = 'read'
,DropLogTable = 'Yes'
------------
The code is:
---------DEFINE JOB qstartcoda2
(
APPLY $INSERT TO OPERATOR ($LOAD)
SELECT * FROM OPERATOR($FILE_READER);
);
---------
I've then tried creating my own job where the schema is explicitly defined as CHAR(1000) as follows:
--------------
DEFINE JOB qstartcoda1
DESCRIPTION 'LOAD CODA TABLE'
(
DEFINE SCHEMA CODA_SCHEMA
DESCRIPTION 'CODA INFORMATION'
(
CODADATA CHAR(1000)
);
DEFINE OPERATOR LOAD_OPERATOR
DESCRIPTION 'TERADATA PARALLEL TRANSPORTER LOAD OPERATOR'
TYPE LOAD
SCHEMA CODA_SCHEMA
ATTRIBUTES
(
VARCHAR TdpId = @TargetTdpId,
VARCHAR UserName = @TargetUserName,
VARCHAR UserPassword = @TargetUserPassword,
VARCHAR TargetTable = @LoadTargetTable,
VARCHAR LogTable = @LoadLogTable,
VARCHAR ErrorTable1 = @LoadErrorTable1,
VARCHAR ErrorTable2 = @LoadErrorTable2
)
;
DEFINE OPERATOR DATACONN
DESCRIPTION 'TERADATA PARALLEL TRANSPORTER DATACONNECTOR OPERATOR'
TYPE DATACONNECTOR PRODUCER
SCHEMA CODA_SCHEMA
ATTRIBUTES
(
VARCHAR FileName = @SourceFileName,
VARCHAR Format = @SourceFormat
);
APPLY ('INSERT INTO '|| @LoadTargetTable ||' (:CODADATA);')
TO OPERATOR (LOAD_OPERATOR [1])
SELECT * FROM OPERATOR (DATACONN[1]);
);
-----------------------
This time I get an error:
DATACONN[1]: TPT19113 Data length implied by Data Schema (1000) is not the same
as record length (226).
I then tried changing the code above so CODADATA is defined as VARCHAR(1000) and I get the first error again:
DATACONN[1]: TPT19108 Data Format 'TEXT' requires all 'CHAR/ANSIDATE' schema.
I can't find much information in the manuals about the text format. Am I missing something that allows me to load a variable length string into a table? The manual basically says that this is what the text format is for:
-----------
'Text' = character data separated by an end-of-record (EOR) marker. The
EOR marker can be either a single-byte linefeed (X'0A') or a double-byte
carriage-return/line-feed pair (X'0D0A'), as defined by the first EOR
marker encountered for the first record.
---------
Sorry if this is a basic query, but I'm new to TPT and can't find this information or any examples in the user guide or reference manuals.
Thanks
Andy