Cleaning flat files using routines

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
Woth
Participant
Posts: 24
Joined: Thu Mar 18, 2004 8:18 pm

Cleaning flat files using routines

Post by Woth »

I'm trying to clean input files (sequential,fixed length) from special characters. Normally, I would use this command

Code: Select all

perl -pe 's/[\x00-\x09\x0B-\x1F]/ /g' < input > output
But I need to be able to parameterize it...therefor cannot use the "execute command" stage.

I'm looking for some info on routines...cannot find a way to execute a command from the routines.

Any pointers on where I could find this info?

Thanks!
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You need a before routine probably.

Code: Select all


* Call routine like #InFileParam#-#OutFileParam#
InFileName = field(Arg1, '-', 1)
OutFileName = field(Arg1, '-', 2)

Cmd = 'SH -c  "':"perl -pe 's/[\x00-\x09\x0B-\x1F]/ /g' < input > output":'"'
execute Cmd capturing output returning RtnCode

ErrorCode = RtnCode
Should be close to correct.
Mamu Kim
Post Reply