issue with null handling

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
Svengiyil
Participant
Posts: 25
Joined: Tue May 05, 2009 12:16 am

issue with null handling

Post by Svengiyil »

Hi,


I have a requirement in which one of the column abc of length 20 (nullable not a key column) has to be left aligned and space padding is to be done if the column value is less than 20 (i.e, if the length is 5 then, after first five char there should be a space of 15).

Here i have used a stage variable stglen to store the length of the column
stglen=Len(trim(In_link.abc)).

and using the isnull function in the transformer
If IsNull(In_link.abc) then space(20) else (trim(DSLink67.short_nm):Space(20-stglen)).

even after doing the above i can still see null value being populated for the above column .

My source is a sybase stage.

Appreciate ur help.

Thanks,
Sheema
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Data type of the column? Could you not just declare it a CHAR and ensure your $APT_PADCHAR is set to a space (0x20)?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Svengiyil
Participant
Posts: 25
Joined: Tue May 05, 2009 12:16 am

Post by Svengiyil »

Hi Craig,

The datatype is char, and could you please let me know where exactly will i find $APT_PADCHAR, is it in the director?


Thanks,
Svengiyil
Svengiyil
Participant
Posts: 25
Joined: Tue May 05, 2009 12:16 am

Post by Svengiyil »

sorry..not director....will i find $APT_PADCHAR setting in the administrator?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Yes, you can find and edit it's default value in the Administrator, then insert and include the variable as a parameter in your job(s).
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I wouldn't touch the current default value in the Administrator, but instead insert it into you job and then change the default value there. Unless you understood what the ramifications of a global change that like could mean.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Svengiyil
Participant
Posts: 25
Joined: Tue May 05, 2009 12:16 am

Post by Svengiyil »

Hi,


I found the variable $APT_STRING_PADCHAR and changed the default value to 0x20...it still din't work for me.

Thanks,
Svengiyil
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Svengiyil wrote:it still din't work for me.
What does that mean ?

What is your target ?

Try writing to a sequential file and check the result.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Please explain to us exactly what you did, what changes you made and what "didn't work for me" means.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Svengiyil
Participant
Posts: 25
Joined: Tue May 05, 2009 12:16 am

Post by Svengiyil »

my target is sequential file itself , i tried changing the variable value $APT_STRING_PADCHAR to 0x20, even after this the resultant column contains null value (same as before).

Thanks,
Svengiyil
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

But... verify for us the data type in the target (is it CHAR now?) and if you removed your previous derivation or not.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Svengiyil
Participant
Posts: 25
Joined: Tue May 05, 2009 12:16 am

Post by Svengiyil »

Yeah.....the datatype in the target is also char..

Thanks,
Svengiyil
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Re: issue with null handling

Post by Sainath.Srinivasan »

Svengiyil wrote: stglen=Len(trim(In_link.abc)).

and using the isnull function in the transformer
If IsNull(In_link.abc) then space(20) else (trim(DSLink67.short_nm):Space(20-stglen)).

even after doing the above i can still see null value being populated for the above column .
Am I right in saying that you are mapping a different column than the one you find the length of.
Post Reply