Failure 2673 The source parcel length does not match data that was defined.

Tools & Utilities

Failure 2673 The source parcel length does not match data that was defined.

I have two bteq scripts, one exports a table to a flat file, the other imports the data right back from the flat file.

My export script :

.export report file= src_qry.out
select count(*) (TITLE' ') , Null (TITLE' ') , NULL (TITLE ' ') , NULL (TITLE ' ') from fds_etl_target.ods_cntrl_all_d; FROM mydb.mytbl ;
.export reset

My import script :

bteq <
.logon system/uid,pwd

.set width 2500;
.set titledashes off;
.set foldline on;

.IMPORT FILE =src_qry.out;
.QUIET ON
.REPEAT *
USING srcresult_nbr1 (INTEGER)
, srcresult_nbr2 (INTEGER)
, srcresult_nbr3 (INTEGER)
, srcresult_nbr4 (INTEGER)

INSERT INTO mydb.mytbl
( 1,
1,
current_timestamp,
:src_nbr1,
:src_nbr2,
:src_nbr3,
:src_nbr4,
'-2',
'MANUAL',
'POST_AGNT',
-2 ,
-1,
'2007-06-01 18:50:18' ,
2,
'2007-06-01 18:50:18' ,
'2007-06-01 18:50:18' ,
'2007-06-01 18:50:18'
);

.logoff
.quit
EOF
The error I am getting
*** Warning: No IMPORT mode was given, assuming field mode.
*** Growing buffer to 65473
*** Failure 2673 The source parcel length does not match data that was defined.
Statement# 1, Info =6

*** Warning: Out of data.
1 REPLY
Enthusiast

Re: Failure 2673 The source parcel length does not match data that was defined.

While using BTEQ IMPORT I am getting the following error. I know that this is due to a data item not matching the definition, i.e. definition set to VARCHAR(5) and data item being 6 charaters.

What I would like to know is how to halt the code and exit with an error code. The objective being to stop the code from processing any more records as soon as an error code occurs. At the momment it carries on to process all the records: -

.SET ERROROUT STDOUT
.SET QUIET ON

DROP TABLE BUSINESS_SECTOR_TEAMS;

CREATE TABLE BUSINESS_SECTOR_TEAMS
(
REGION INTEGER COMPRESS
,TEAM VARCHAR(60)
,TEAM_ABR VARCHAR(6)
,TEAM_ID INTEGER NOT NULL
,GROUP_ID INTEGER COMPRESS
,GROUP_NAME VARCHAR(50)
)
UNIQUE PRIMARY INDEX (TEAM_ID);

.if errorcode <> 0 then .quit errorcode

.IMPORT VARTEXT '|' FILE=f:\DATA\TD_automation\DATA\1155.tdd

.if errorcode <> 0 then .quit errorcode

.REPEAT*

.if errorcode <> 0 then .quit errorcode

USING (C1 VARCHAR(5)
,C2 VARCHAR(60)
,C3 VARCHAR(6)
,C4 VARCHAR(6)
,C5 VARCHAR(5)
,C6 VARCHAR(50))

INSERT INTO BUSINESS_SECTOR_TEAMS
(REGION
,TEAM
,TEAM_ABR
,TEAM_ID
,GROUP_ID
,GROUP_NAME)
VALUES (:C1
,:C2
,:C3
,:C4
,:C5
,:C6)
;

.if errorcode <> 0 then .quit errorcode