First Character of source to First char of target

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
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

First Character of source to First char of target

Post by rafidwh »

Hi All,
My source is a flatfile and target is an OCI,my scenario is I have source column srcCol and corresponding target column TrgCol1

SrcCol1 (Datatype - Char(1)) is moved to column TrgCol1 (Datatype - Char(2))of table .
So srcCol1 should be moved to the first character of column TrgCol1

If I have Data like
srcCol1 -A then the it should populate in Trgcol1 as "A_ " not as "_ A"

I mean source column value should go to the first charcter of the target column not to the second character.

Will The Datastage implicitly take the value in the first character itself or should I need to explicitly put the value only in the first character.

Please suggest

Regards,
Saik
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You are going from CHAR(1) to CHAR(2). Use explicit padding of one space in your derivation. The derivation for TrgCol1 is

Code: Select all

SrcCol1:' '
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

Thankyou Arndw
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Re: First Character of source to First char of target

Post by rwierdsm »

Saik,

I think this is really more of a display issue in whatever tool is used to access the data in Oracle.

However, if you wish to have the data left justified instead of right justified in the Oracle column, just concatenate a blank to your input column, i.e. TrgCol1 = SrcCol1 : ' '

Hope this helps,

Rob W.
Rob Wierdsma
Toronto, Canada
bartonbishop.com
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ArndW wrote:You are going from CHAR(1) to CHAR(2). Use explicit padding of one space in your derivation...
Isn't that... completely unnecessary? Since when will char fields be right justified? Just map one to the other, no extra who-ha needed. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You are right, in 99% of the cases this is unnecessary as the implicit padding will be right when going to a VarChar from CHAR. But sometimes the default pad character might not be set to space - so in this type of scenario I'd always opt for the explicit method. I am thinking more of PX jobs than server ones at the moment for this padding question, though.
Post Reply