Hi TD Guru's,
I am facing an issue where I am trying to load a Fixed width file using TPT load. It has a few FILLER columns that I need to ignore and I am running into the issue as described in the subject. Could someone please help me out?
thsi is the error "TPT19113 Data length implied by Data Schema (23) is not the same as record length (22)". I checked the file and the length of each record is 23. I do not seem to unerstand why it complains
Here is the TPT script.
DEFINE JOB LOAD_TB1
DESCRIPTION 'LOADING THE TB1 table'
(
DEFINE SCHEMA TB1_SCHEMA
DESCRIPTION 'Schema for the TB1 table'
(
COL1 CHAR(02),
COL2 CHAR(10),
COL3 CHAR(06),
COL4 CHAR(04),
FILLER CHAR(01)
)
;
DEFINE OPERATOR DDL_OPERATOR
TYPE DDL
ATTR
(
VARCHAR PrivateLogName = 'TB1_LOAD_LOG',
VARCHAR TdpId = @TdpId,
VARCHAR UserName = @UserName,
VARCHAR UserPassword = @UserPassword,
VARCHAR TargetTable = @TargetTable,
VARCHAR ErrorTable1 = @ErrorTable1,
VARCHAR ErrorTable2 = @ErrorTable2,
VARCHAR WorkTable = @WorkTable,
VARCHAR LogTable = @LogTable,
VARCHAR ErrorList = ['3807','2580']
);
STEP LOAD_TABLE
(
APPLY
(
'INSERT INTO '||@TargetTable||'
(
NPA,
NXX,
LINE,
DAY_OF_MONTH,
COL3,
COL4
)
VALUES
(
SUBSTR(TRIM(:COL2),1,3),
SUBSTR(TRIM(:COL2),4,3),
SUBSTR(TRIM(:COL2),7,4),
TRIM(:COL1),
TRIM(:COL3),
TRIM(:COL4)
);'
)
TO OPERATOR
(
UPDATE_OPERATOR[1]
ATTRIBUTES
(
UserName = @UserName,
UserPassword = @UserPassword,
LogTable = @LogTable,
TargetTable = @TargetTable,
MaxSessions = @MaxSessions,
ErrorTable1 = @ErrorTable1,
ErrorTable2 = @ErrorTable2,
Worktable = @WorkTable,
WorkingDatabase = @WorkingDatabase,
TdpId = @TdpId,
ErrorLimit = 1
)
)
SELECT
COL1,
COL2,
COL3,
COL4,
FILLER
FROM OPERATOR
(FILE_READER[1]
ATTRIBUTES
(
DirectoryPath = @DirectoryPath,
FileName = @FileName,
RowErrFileName = @RowErrFileName,
MultipleReaders = 'Y',
Format = 'text',
OpenMode = 'Read',
IndicatorMode = 'N'
)
);
);
);