Varchar Field Truncation Issue : Sequential File

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
bbobpop1
Participant
Posts: 29
Joined: Sun Jul 20, 2008 9:55 am

Varchar Field Truncation Issue : Sequential File

Post by bbobpop1 »

Hi

I am using a comma seperated sequential file as a source. One the columns called "A" in this file has a datatype VARCHAR(30).

The target is database and Column "A" is populating Column "B" of Database.(Size of B: Varchar(30)).

If the length of the incoming field is more than 30, I want to catch that record in to rejected file and continue the processing.

I have tried the option in the sequential File like "Reject Mode"= Output. It is rejected the records for Integer (/ Date Format MisMatch) DataType but not for the varchar datatype.It is reading the Column by truncating the Values.

I changed the datatype to "Char", but then I am not able to read the file.I was searching for the simillar issue in the forum but was not able to find the appropriate.

Can you please guide me on the same?

Thanks
Bob
dh_Madhu
Premium Member
Premium Member
Posts: 65
Joined: Sat Apr 23, 2005 3:19 am
Location: Stirling, Scotland

Post by dh_Madhu »

Did you view the data through the seq file....also check the column ordinalities between the source and the target..
Regards,
Madhu Dharmapuri
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Remove the max length from A and add the check in a transformer in the flow.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Remove the max length from A and add the check in a transformer in the flow.
bbobpop1
Participant
Posts: 29
Joined: Sun Jul 20, 2008 9:55 am

Post by bbobpop1 »

Thanks

I have mentioned the column size VARCHAR(30) in sequential File. Also I can view data (with Truncated data) in sequential file.

Both Source and Target has same data type.

Also Can you please let me know which function I can use to check the len of decimal, varchar etc...

Please let me know if you need more information.

Thanks
Bob
Last edited by bbobpop1 on Fri Mar 13, 2009 8:02 am, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, you'll need to increase the field size you are using in the Sequential File stage and then do a length check on the string, logically rejecting it if it is longer than 30 characters.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bbobpop1
Participant
Posts: 29
Joined: Sun Jul 20, 2008 9:55 am

Post by bbobpop1 »

I am using the logic which has mentioned above. Now I am facing one m more challenge. Can you please let me know how to avoid truncation of decimal fields / check lenght of decimal fields (Precision and scale) to fit the exact target definition?
Thanks
bob
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As noted elsewhere (did you Search?) the string requires two extra character positions - one for the sign and one for the decimal placeholder character (unless scale = 0).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Pagadrai
Participant
Posts: 111
Joined: Fri Dec 31, 2004 1:16 am
Location: Chennai

Post by Pagadrai »

Hi,
Is the issue resolved?
I just went through the following writeup in manual.
See if it helps your case.

" APT_IMPORT_REJECT_STRING_FIELD_OVERRUNS
When set, DataStage will reject any string or ustring fields read that
go over their fixed size. By default these records are truncated. "

Let me know once you try this.
Post Reply