Troubleshooting
Problem
When calling an external program using the ITX Batch Adapter, and passing the commands to execute using the -STDIN option, the spaces are being interpretted as <NL> sequences
Single commands work fine, but commands comprising of multiple parts separated by a space don't. Every space is treated as an <NL>.
For example, calling the DOS 'sort' command at the Command Prompt:
Y:\Batch>sort < Input.txt
alpha bravo charlie
....and this is expected. The following ITX map rule that uses the Batch adapter however:
=GET ("BAT","-TV -CMD " +""""+"sort " + """" + " -STDIN " + """" + "alpha bravo charlie" + """")
...produces:
alpha
bravo
charlie
Symptom
"alpha bravo charlie" used with the -STDIN command line option of the ITX Batch adapter will produce
alpha<NL>
bravo<NL>
charlie
....as stdin input to the command line program being called
Cause
This behaviour has been identified as a limitation of the current Batch adapter under APAR PH06544.
Environment
IBM WebSphere Transformation Extender (WTX) 8.4.1.x / IBM Transformation Extender (ITX) 9.0.0.x maps running on Windows, using the Batch adapter to call external command line programs.
Diagnosing The Problem
A review of the command received by the program (such as capturing them with an intermediary script) will show that errant <NL> sequences where spaces should be.
Resolving The Problem
Obtain and apply the fix for APAR PH06544 which has enhanced the functionality of the Batch adapter so that the user can escape (or group) any strings where the spaces need to remain unchanged with single quotes at the start and end. Example:
=GET ("BAT","-TV -CMD " +""""+"sort " + """" + " -STDIN " + """" + "'alpha bravo charlie'" + """")
or
=GET ("BAT","-TV -CMD " +""""+"sort " + """" + " -STDIN " + """" + "'alpha bravo' charlie" + """")
....if the requirement is to have alpha and bravo on the same line separated by space, but have charlie as a command on a new line.
Was this topic helpful?
Document Information
More support for:
IBM Transformation Extender
Software version:
8.4.1.5, 9.0.0.3
Operating system(s):
Windows
Document number:
791809
Modified date:
18 February 2019
UID
ibm10791809