Skip to Content
Author's profile photo Michal Krawczyk

XI: Operation system command – error catching

There’ve been many posts on the XI forum

where some of you where asking why your OS command

doesn’t get executed inside your Adapter and you don’t know what’s wrong.

I decided to check if there’s any simple way of dealing with this problem 🙂

Here’s my solution:

Once you set your communication channel (in my case it’s file/ftp)
you can set it to store the file on the File system (Transport Protocol).

Then you set target directory on the Server and the filename

image

Now the fun part:)

If your command isn’t executing correctly you can easily
store the error message in any file you want.

In my example I’m using the same folder as the one in which
I store my XML files from the Receiver adapter.

image

As you can see I execute a non existing command “echooo”

When I run my scenario apart from the XML file I can find
demo1.txt file with the descripion of the error :

‘echooo’ is not recognized as an internal or external command,
operable program or batch file.

I was working in the Windows NT environment (server)

but this should also be possible on Unix systems

I hope this little “trick” will be helpful to some of you.

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi
          Good trick, pretty useful, but do you have any idea how to use the trick in AS/400. I have to call a library program in AS/400 like
      CALL PRGM(STDSAPOUT) PARAM('file.txt'). This command triggers a job in AS/400. but it is not triggering anything.

      Thanks in advance.
      Sujan

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author
      Hi Sujan,

      sorry don't know as/400...
      but maybe you can ask your basis team?

      Regards,
      michal

      Author's profile photo Ravi Raman
      Ravi Raman
      Sujan,

      you shouldent have to do that, See if you have PASE for i5, then run the command from QSH...

      Regards
      Ravi Raman

      Author's profile photo Ravi Raman
      Ravi Raman
      michal/Sujan,

      check installed pgms..look for i5 PASE..which is the aix toolkit for as400.
      Then run the command as a qsh command,
      QSH runCommand.sh

      Regards
      Ravi Raman

      Author's profile photo Bernhard Josef Neuhauser
      Bernhard Josef Neuhauser

      only use this "command processing" with an script file

      Author's profile photo Former Member
      Former Member
      Hi Michael,

      i tried to put the following command into the before message processing command line:
      "copy /XI/ECHtoSAP/ELEC/%f  /XI/ECHtoSAP/MECOM/%f"

      But the result is as follows:
      Error when executing OS command "copy /XI/ECHtoSAP/ELEC/MEC_ECH210_20070710_126757625.dat  /XI/ECHtoSAP/MECOM/MEC_ECH210_20070710_126757625.dat"

      The transport protocol is FTP.
      Is it possible to copy the file before it is processed by the fileadapter?
      Thanks for a quick answer
      regards Marlies

      Author's profile photo Ravi Raman
      Ravi Raman
      michal/Sujan,

      check installed pgms..look for i5 PASE..which is the aix toolkit for as400.
      Then run the command as a qsh command,
      QSH runCommand.sh

      Regards
      Ravi Raman

      Author's profile photo Sudheer Jallipalli
      Sudheer Jallipalli
      Michael,
      Thank you so much for this small but wonderful idea on catching errors when executing the command.

      This helped me to find out the script issues easily.

      Author's profile photo Hari Sonnenahalli
      Hari Sonnenahalli

      Michael-

       

      Hope all is well:)

       

      I am using  command line in PI to zip all the files in a given folder. PI is running on ORACLE Database. The OS command is not executing at all. I have used your trick to write an error long and also have used wrong command so that it would error out in channel and nothing is happening.  In communication channel log it says OS command executed. I am thinking if there are any configuration missing during PI install to execute OS command. Please throw some taughts. You can find my dissucssion here: Command Line is not executing using File Adpater

       

      Please let me know.

       

      Regards

       

      HS

      Author's profile photo Anupam Ghosh
      Anupam Ghosh

      Nice blog, waiting for more from you