Call AS400 Remote Command from Linux

AtlantuX
AtlantuX used Ask the Experts™
on
Hi,

Is it possible to run a Remote Command on an AS400 from Linux? On Windows this is done by an ActiveX component.

Thanks,
Janno.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
iSeries Engineer
Commented:
Sure can, if you are using FTP. I dug out an article that talked a bit about it.

Many of you use FTP to transfer files between systems, and FTP is an excellent tool for that purpose. Did you also know that by using FTP, you can enter commands on remote systems? You can do this with the quote command. The quote command lets you send arbitrary commands to the FTP server. By using server sub-commands in conjunction with the quote command, you can execute most AS/400 commands from within your FTP session. Using this approach, you can create files, restore objects, etc. as part of your FTP job stream. The AS/400 sub-command that allows you to do this is rcmd, which allows you to execute remote commands through your FTP server.
 
Example: quote rcmd CLRPFM FILE(MYLIB/MYFILE) -- Will clear the specified file on the remote system

If you are in an FTP session and want to enter a command on the LOCAL system, you can use the ! command. This works a little differently on the AS/400 and in Windows.

If you enter ! from the a Windows DOS prompt FTP session, you temporarily exit to the DOS prompt until you decide to resume your FTP session. If you enter ! from an AS/400 FTP session, the AS/400 expects you to follow it with an AS/400 command.

Example: ! sndmsg msg(Hello) tousr(tim)

Although not related to the topic at hand, here is another server sub-command I find very useful:

By default, your FTP session will time out after five minutes of inactivity. Using the time command you can increase that amount of time to whatever you choose.

Example: quote time 10000 -- Sets the FTP inactivity timeout to 10,000 seconds


Hope it helps!!!

Author

Commented:
Hi Samic,

Thanks for your support! Next week I'll test it via ftp. Quit simple :)

Thanks!
Janno.

Author

Commented:
Hi!
I tried it. It works for creating libraries etc. But my command isn't working?!

ftp> quote RCMD CALL PGM(IPERENWM/OMZ701C) PARM('2062')
550-Error occurred on command CALL PGM(IPERENWM/OMZ701C) PARM('2062').
550 Fout gevonden in opdracht CALL..

Does anyone know what the problem can be? This command is working okay in Delphi with RemoteCommand button.

Thanks!
Janno.

Author

Commented:
Hi!
I tried it. It works for creating libraries etc. But my command isn't working?!

ftp> quote RCMD CALL PGM(IPERENWM/OMZ701C) PARM('2062')
550-Error occurred on command CALL PGM(IPERENWM/OMZ701C) PARM('2062').
550 Fout gevonden in opdracht CALL..

Does anyone know what the problem can be? This command is working okay in Delphi with RemoteCommand button.

Thanks!
Janno.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial