Char40 to Char10

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ds_is_fun
Premium Member
Premium Member
Posts: 194
Joined: Fri Jan 07, 2005 12:00 pm

Char40 to Char10

Post by ds_is_fun »

Im moving data from source type CHAR40 To target type CHAR10.
When I load the data into SQLSERVER im getting an Warning message -
Ref_T63GS02_Load_S_T_US_v6..Transformer_2.DSLink4: DSD.BCIPut call to SQLExecute returned informational message.
SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated

Job runs successfully but for every row there is the above message in Director.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Stop letting the database truncate the data for you, do it yourself in the job. Substring off only the first 10 characters and move that into the smaller field.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post by ds_developer »

Are you trimming the data? If a varchar 40 is loaded (in your source) with trailing spaces, the spaces will remain. Usually you want to trim those off. Even after that, you should only use the first 10 characters in your target field. The syntax for that is [1,10] on the output derivation of the incoming field.

John
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you do want the database to perform the truncation, specify it as CHAR(10) and extract it using the SUBSTRING function in SQL.

Otherwise extract as Char(40) and use an appropriate function (such as Left()) or a substring operator to obtain the leftmost 10 characters.

In all of this, although you did not specify, I have assumed you simply want to discard the remaining 30 characters. For you simply can not shoehorn 40 characters into a Char(10) field.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply