DataStage scenario based question:
There is a column having both numbers and alphabet, the requirement is to separate all the numbers in one column and alphabet in other column.
Input File(Data)
Data
1Da4ta3St1age4
I34B09M67
67I5nfo45sp7eh9er0e
3W4in67gs89of06tec23hn56ol77ogy44
1Da4ta3St1age4
I34B09M67
67I5nfo45sp7eh9er0e
3W4in67gs89of06tec23hn56ol77ogy44
Output File(Alpha,Number)
Alpha,Number
IBM,340967
Wingsoftechnology,3467890623567744
DataStage,14314
Infospehere,67545790
IBM,340967
Wingsoftechnology,3467890623567744
DataStage,14314
Infospehere,67545790
Solution:
First read the input data in sequential file stage:
Next pass the input data to transformer stage. We can separate alphabets and numeric using 2 stage variables in transformer stage.
Create stage variables like below:
svAlpha: Convert("0123456789","",lnk_alphanumerics.MixData) svNumerics: Convert(svAlpha,"",lnk_alphanumerics.MixData)
Read also: What is a Schema File in DataStage?
Assign these stage variables to output columns like below.
svAlpha = Alpha svNumerics = Number
Final job design would be:
Compile and run the job.
We will get output like below.
Hi,
Thanks for the great blog for learning. I am new for Datastage and it is very helpful for me to understand. It would be great if you can add additional details (Step by step process) so that beginners can understand easily. Thanks for the support keep it up the good work.
Thanks
Vignesh