Showing posts with label Transformer. Show all posts
Showing posts with label Transformer. Show all posts

Tuesday, January 29, 2013

Double convert in Datastage


Convert Function

Replaces every instance of specified characters in a string with substitute characters.

Syntax-Convert (list, new.list, string)
The two lists of characters correspond. The first character of new.list replaces all instances of the first character of list, the second replaces the second, and so on. If the two lists do not contain the same number of characters:
1)Any characters in list with no corresponding characters in new.list are deleted from the result. 
2)Any surplus characters in new.list are ignored.
3)We can not replace a string with string  by using convert function we have to use parallel Ereplace c++ routine

Example-How to separate alphabets and numeric values?

Input               
col             
Abc123456            
Pqrs698               

output              
col_1,col_2                 
Abc,123456
Pqrs,698

Convert(Convert('ABCDEFGHIJKLMNOPQRSTUVWXYZZ','',Upcase(Col))
,'',Col)=col_1
Convert(Convert('0123456789','',Upcase(Col)),'',Col)=col_2

Here I am using  second point as a reference

Tuesday, December 4, 2012

How to abort the Job based on Condition?

I/p

col 
100 
200 
300 
100 
100 

If any records come other than 100 in col column, I need to abort the job. 

We can use Transfomer to abort the Job based upon certain condition

If Inlink.col<>"100" Then 'Y' Else 'N'=StgVar

Constraint: 

StageVar='Y'

Abort After rows=1