Page 1 of 1

Cleaning flat files using routines

Posted: Fri Nov 05, 2004 8:18 am
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!

Posted: Fri Nov 05, 2004 9:33 am
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.