Calling Unix script in Datstage Transformer
Moderators: chulett, rschirm, roy
Calling Unix script in Datstage Transformer
Hi,
Can we call Unix script in Datastage job for every output row of a Transformer stage or is there any way to call Unix script for every output row of any stage?
Thanks,
Sid
Can we call Unix script in Datastage job for every output row of a Transformer stage or is there any way to call Unix script for every output row of any stage?
Thanks,
Sid
Sid
This is a very simple routine executes a Unix command which is passed to it, and returns the output of the command. It Can be called from a transformer - but the command output needs to be formatted in the way you need ( watch out for field and item seperators, newlines etc)
Input Arguments:
Arg1: command to be executed
Return:
Ans: output of command
Input Arguments:
Arg1: command to be executed
Return:
Ans: output of command
Code: Select all
Command = Arg1
Call DSExecute("UNIX", Command, Output, SystemReturnCode)
If SystemReturnCode Then
Message = "Unable to execute command - " : Command : " Output - " : Output
Call DSLogFatal(Message,"ExecUNIXcmd")
Ans = Message
End
Ans=Output
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Ans = Message
Code: Select all
Ans = Output
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Actually that routine works while testing . but was not implemented. There's another routine that can do the trick
Arguments : UnixCmd, Seperator
Arguments : UnixCmd, Seperator
Code: Select all
Command = UnixCmd;
SepDef = If IsNull(Seperator) Then @FM Else Seperator ;
Message = ''
Call DSExecute("UNIX", Command, Output, SystemReturnCode)
If SystemReturnCode = 0 Then
Message = "Executed command: " :Command :""
Ans = Trim(Ereplace(Output,@FM,SepDef))
End Else
Message = "Unable to execute command - " : Command : " Output - " : Output
Call DSLogFatal(Message,"ExecUNIXcmd")
Ans = Message
End