Finding and Replacing all Non Printable Characeters

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
horserider
Participant
Posts: 71
Joined: Mon Jul 09, 2007 1:12 pm

Finding and Replacing all Non Printable Characeters

Post by horserider »

Hello,

I am processing an employee file and the Name Column has some hidden characters some of them like

Horizontal Tabs (009)
Carriage return (002)

One way to check is to Use the SEQ() function on each of the caharacters on the Name Column, check the Value and replace them with something else...example for Horizontal tabs and carriage Return I can replace them with space....but that will require reading each and every character 1 by 1 in Name Column....

Question

Is there a way to use some Replace Function in parallel job that would replace any such characters in one command and I don't have to do the conversion manually?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Convert() function.

Code: Select all

Convert(Char(9):Char(12), "", InLink.TheString)
This solution is sub-optimal, because it re-evaluates the Char() function twice for every row processed. Better would be to initialize a stage variable to Char(9):Char(12) and use that in the derivation expression.

Code: Select all

Convert(svNonPrintingCharacters, "", InLink.TheString)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply