Logic to split a column 100 characters long into 4 chunks...
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
Logic to split a column 100 characters long into 4 chunks...
Hi,
I am stuck with a tricky scenario. I have to split a column 'customer_name' which is 100 characters long into 4 chunks. The tricky part is that I am supposed to split it at spaces and also, then max number of characters in a chunk shouldn't be greater than 35. Is there a way we can do this in Datastage.
Any help is aprreciated.
Thank you.
I am stuck with a tricky scenario. I have to split a column 'customer_name' which is 100 characters long into 4 chunks. The tricky part is that I am supposed to split it at spaces and also, then max number of characters in a chunk shouldn't be greater than 35. Is there a way we can do this in Datastage.
Any help is aprreciated.
Thank you.
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
INDEX(In.Col[1,35],' ',DCOUNT(In.Col[1,35],' ')-1)
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 12
- Joined: Wed Jun 13, 2007 2:12 am
Re: Logic to split a column 100 characters long into 4 chunk
We can achive such functianlity by using Transformer and Stage Variables.Minhajuddin wrote:Hi,
I am stuck with a tricky scenario. I have to split a column 'customer_name' which is 100 characters long into 4 chunks. The tricky part is that I am supposed to split it at spaces and also, then max number of characters in a chunk shouldn't be greater than 35. Is there a way we can do this in Datastage.
Any help is aprreciated.
Thank you.
In Stage Variable cut the column by using Left and Right Function like
Left(Column_Name, 25). Use such function in four stage variables and cut the column accordingly.
Hope this helps
guarav - the original post states that words cannot be split, which is what doing a straight substring extraction would do.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 12
- Joined: Wed Jun 13, 2007 2:12 am