How to stop default type conversion in MODIFY stage

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
rohit_mca2003
Participant
Posts: 41
Joined: Wed Oct 08, 2008 9:19 am

How to stop default type conversion in MODIFY stage

Post by rohit_mca2003 »

Hi,

I have generic job where I am handling NULL and performing TRIM for string type of column.
As output column of these, If I do not assign data length for output then by default it increases the length of the column. Example:

CASE1:
---------
Output_Col:string=handle_null(in_col,' ')
Output_Col:string=string_trim(in_col)

In source in_col is defined as VARCHAR(20) but after these conversion it increases the length to maximum limit of VARCHAR and since in target it is defined as VARCHAR(20) so job fails because of increased length.

I could define these conversions as below to take care of this issue, when I define the rule as below, I do not get above error & job works fine.

CASE2:
--------
Output_Col:string[20]=handle_null(in_col,' ')
Output_Col:string[20]=string_trim(in_col)

But it might change the value of the 'in_col' with in 'Output_Col'.
I can say this because when I generate CHECKSUM on 'Output_Col' then I get different value in CASE1 and CASE2.

Queries:
1. Is there any way I handle this and datatype length does not change after these conversions (as in CASE1)?
2. I came to know there is a 'environment' variable which stops MODIFY operator to change the datatype or length, but I am not able to find it. Any Idea on that variable?

Any help in this would be great help. Thanks.
Rohit
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps APT_OLD_BOUNDED_LENGTH?
-craig

"You can never have too many knives" -- Logan Nine Fingers
rohit_mca2003
Participant
Posts: 41
Joined: Wed Oct 08, 2008 9:19 am

Post by rohit_mca2003 »

This option does not restrict the length of output_col. We have used this parameter earlier to restrict the usage of disk and scratch space.
Rohit
rohit_mca2003
Participant
Posts: 41
Joined: Wed Oct 08, 2008 9:19 am

Post by rohit_mca2003 »

This issue is resolved when I defined the conversion as below:

Output_Col:string[max=20]=string_trim[in_col]

If I assigned the value as string[20], is was treating it as CHAR and adding space so defining it as max=20 did the work and it is not exceeding upto the maximum limit of varchar.

Thanks.
Rohit
Post Reply