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
Svengiyil
Participant
Posts: 25 Joined: Tue May 05, 2009 12:16 am
Post
by Svengiyil » Fri Sep 18, 2009 7:49 am
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
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 18, 2009 7:57 am
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 » Fri Sep 18, 2009 8:09 am
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 » Fri Sep 18, 2009 8:11 am
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 » Fri Sep 18, 2009 8:12 am
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
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 18, 2009 8:23 am
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 » Fri Sep 18, 2009 8:30 am
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 » Fri Sep 18, 2009 8:38 am
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
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 18, 2009 8:39 am
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 » Fri Sep 18, 2009 9:09 am
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
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Fri Sep 18, 2009 9:26 am
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 » Fri Sep 18, 2009 9:34 am
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
Post
by Sainath.Srinivasan » Fri Sep 18, 2009 9:39 am
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.