Data needs to change

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
Sourav
Participant
Posts: 17
Joined: Tue Sep 04, 2007 5:34 pm
Location: Delhi

Data needs to change

Post by Sourav »

Hi ,

I have a source records like
USG12320090403145343NES2_Erc_VTTF2972.data but i need only
NES2_Erc portion . so kindly help me
arvind_ds
Participant
Posts: 428
Joined: Thu Aug 16, 2007 11:38 pm
Location: Manali

Post by arvind_ds »

Do you have all the source records of fixed length.? Is the position of NES2_Erc string same across all the records.? If yes, then use left and right functions to cut the desired portion from the input string(s).

HTH
Arvind
Sourav
Participant
Posts: 17
Joined: Tue Sep 04, 2007 5:34 pm
Location: Delhi

Data needs to change

Post by Sourav »

This records are not fixed length and all records are different and USG12320090403145343 records are fixed with NES2_Erc string [ Only applicable for this records ] .
I am given you another records like USG10420090515091147HYD_MSS3_VTTF9741.data .

Kindly help me .
arvind_ds wrote:Do you have all the source records of fixed length.? Is the position of NES2_Erc string same across all the records.? If yes, then use left and right functions to cut the desired portion from the input string(s).

HTH
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This is very easy with MatchField() functions and concatenation in a BASIC Transformer stage.

If you know that there are always four characters before the first underscore, then there is a solution using Index() and substrings.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

It seems you are getting date timestamp before your string.

USG12320090403145343NES2_Erc_VTTF2972.data
USG10420090515091147HYD_MSS3_VTTF9741.data

Code: Select all

If this is always the same case, you could probably use something like Col1[21,Len(Field(Col1,'_',2))]

Col1 --> Your source column in Varchar format
Thanks and Regards!!
dspxlearn
Post Reply