The command line Connector enables you to read the output from a command line or pipe data to a command line's standard input. Every command argument is separated by a space character, and quotes are ignored. The command is executed on the local machine.
You do not get a separate shell, so redirection characters ( | > and so forth) do not work. To use redirection, make a shell-script (UNIX) or batch command (DOS) with a suitable set of parameters. For example, on a Windows system, type
cmd /c dirto list the contents of a directory.
The Connector supports Iterator and AddOnly mode, as well as CallReply mode.
In Iterator and AddOnly mode, the command specified by the Command Line parameter is issued to the target system during Connector initialization, which implies it will only be issued once for the whole AssemblyLine lifetime.
However, in CallReply mode, the command is issued to the target system on each iteration of the AssemblyLine, after Output Attribute Mapping (call phase), and before Input Attribute Mapping (reply phase). In this mode, provide the command to be executed in an attribute called command.line; after it has executed you will find the output result in an attribute called command.output.
If a Parser is attached to the Command Line Connector, the output result will be parsed.
When you use the Command Line Connector to run a program on a Windows operating system, the output from the program might be encoded using a DOS code page. This can cause unexpected results, because Windows programs usually use a Windows code page. Because a DOS code page is different from a Windows code page, it might be necessary to set the Character Encoding in the Command Line Connector's Parser to the correct DOS code page for your region; for example: cp850.
The same issue may arise on for example i5/OS; here the output from commands is usually encoded in the IBM037 character set; and on z/OS it could be EBCDIC.
Also see Character Encoding conversion.
On Linux/Unix systems, this Connector has the capability to attempt to deal with the quoting of parameters that may contain lexically important characters. When the parameter Use sh is checked, TDI uses the sh program (for example, the standard Linux shell) to run the command line, and sh will handle quoting as you expect. If you do not have sh on your operating system, do not check this box.
Without using sh, when the Command Line Connector is run on a Unix/Linux platform, it does not handle a command line with a parameter in quotes correctly. For example, the command:
Report -view fileView -raw -where "releaseName = 'ibmdi_60' and nuPathName like 'src/com/ibm/di%' "
This command should have the phrase "releaseName = 'ibmdi_60' and nuPathName like 'src/com/ibm/di%' " as one parameter, but it does not. The reason is that TDI uses the Java™ Runtime exec() method, which splits all commands at spaces, and ignores all quoting. We would have liked this to be split according to the quotes. Checking Use sh (when possible) solves this problem.
The Connector needs the following parameters:
This feature is only available on operating systems which provide the "sh" shell command interpreter (usually UNIX-like operating systems).
Refer to the root_directory/examples/commandLine_connector directory of your IBM TDI installation.
Remote Command Line Function Component,
z/OS TSO/E Command Line Function Component