Checking for two types of records in the same column

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
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Checking for two types of records in the same column

Post by dspxlearn »

Hi,


I have a requirement where, i have a source column from which i am getting two types of records which are numeric and alphanumeric which is defined as Varchar field in the DS job.
Now my requirement is, if a record with all numeric characters comes, the preceding zeros should be deleted.
if a record with alphanumeric characters comes, the preceding zeros should be preserved.
So, this requirement is for the records prepadded with zeros.
Can it be achieved for the same column? :!: :!:
Thanks and Regards!!
dspxlearn
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Use alnum() function in transformer to check whether the incoming column is a Alpha numeric. If yes keep as it is else use trim to trim of the leading 0s.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Surely alnum("000034A3c") would return true, since every character is alphanumeric? Where does it require a leading alphabetic character?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Perhaps you can use this

Code: Select all

If Num(DSLink.filed) then Trim(DSLink.field,'0','L') Else DSLink.field
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply