Call script and pass params from IBM AS400 - any takers?

Okay, I can call an app and pass parameters to it from another mac just fine.

But, I’m looking for a way to do it from an IBM AS400. For the past few years we’ve done this by spooling text files via ftp. Now, I really need to make direct calls - and while I can limp around I am not a 400 programmer - desperately hoping someone here has access to this knowledge.

I can do this in a number of ways from another mac - telnet - ssh - eppc, I can even do it from our 400 over telnet. Unfortunately none of the 400 programmers in our shop know how to script telnet; here is the basic syntax of the remote command-

osascript -e 'tell application "someapp" to someHandler(param1,param2)'

In the reverse situation, I use ftp subcommands to call CL’s on the 400 from my eMac. Stands to reason I should be able to do the reverse - not that I can see.

I also tried enabling rexecd (scary) and using the 400 command RUNRMTCMD. From the syslog, I am able to see that I am making contact with my eMac as soon as I send the remote command, but the spooled message back on the 400 is “Invalid Password”. But, the password is correct. To be thorough, here is that command - note I was simply trying to send a command to make my eMac beep.

 RUNRMTCMD CMD('osascript -e "beep 3"') RMTLOCNAME('some.ip.add.ress' *IP) RMTUSER('myusername') RMTPWD('mypassword')                                                       

Now, I know this may be out there - but, I thought I’d try nonetheless. This board never fails to amaze me. I’ve scoured Midrange bbs’s - Google, and IBM’s site.

Best regards,

No idea what you are talking about, but perhaps I can share some idea. Basically, you need talk to an applescript application from a remote machine which is not a mac. And you can’t execute “osascript” or a different shell command in the remote mac.
Perhaps you can configure the app in the mac to be allways-opened and monitoring a specific folder where you will drop some text files (via ftp or something). The app will read these and understand the instructions.
Or perhaps you can send an email to the mac, which will be received in a applescript-able client, such as Mail, Outlook, Entourage, Eudora… And this client, after matching some basic security rules, such as “if email is from, and subject is whatever, then” read and execute first line of body → which is: tell application “foo” to dosomething(“a”, “b”).

Sorry jj, I probably wasn’t very clear in my original post. We are already ftp’ing text files from our mainframe - have been for years. What I am trying to do is speed up the exchange by calling the script directly. I’d really like to move away from ftp’d text files. I’d considered receiving requests via http but alas, our programmers don’t know how to issue or let alone script a command like that. Email would be too slow as well - but thanks for the suggestions! I can execute osascript via telnet but nobody in our shop knows how to script telnet on the 400.

The RUNRMTCMD is an an AS400 specific command - more specifically the rexec client. I was wondering if anyone had experience with the remote execution server (rexecd), sockets programming, or if anyone would know why I keep getting invalid password errors when I have the login info correct? I have a feeling I can actually issue the osascript command over this protocol - I just need to figure out why rexecd won’t accept my password. And, it really seems to be narrowed down to password - cuz if I use a login name that is incorrect, the message I receive back changes to incorrect login.

Or - perhaps I should be thinking of a different method - outside of remote execution to have a foreign platform call a script. I know - this really isn’t an IBM BBS - I just thought I’d try in hopes of finding someone who is doing this or something like this. Or, at the very least find out what I am doing wrong to get the incorrect password message.

http requests? Do you mean through a web page or something as ‘curl’? Then you could invoke a perl script in the mac, then execute osascript there. Or, better, call directly an applescript-cgi. Check this:

It’s been a VERY long time since I did anything like this, so I can’t offer much help. I think you’ll probably need to find some help from an as400 wiz. Are your guys doing RPG or Java. If they’re RPG’ers, you’ll probably need to go to a 400 BBS for help. Of course, as soon as you say “Mac” they’ll probably shut down. Sometimes you just can’t win…

Back in the day, RUNRMTCMD was used to run apps on DOS or Windows PCs – not other AS400s or Unix boxes. You had to have the CWBRXD.EXE daemon running on the windows box to get it to work. It may well have been changed since then. It would seem so since your call is at least trying to authenticate. Have you tried a RUNRMTCMD against a windows box as a reality check?

If runrmtcmd has been modernized, it’s probably connecting up with unix’s rexecd.

Run PS in terminal to see that rexecd is running. Make sure no firewall or router is blocking its port. (512 I think – try pinging that on your mac from another box near the AS400 to see if you’re getting through – though you likely are since your getting authentication messages.)

If you don’t see rexecd in PS, look in /etc/services and get the “#” comment out from it’s line and reboot.

The following are not known to be useful, and should not be enabled unless

you have a specific need for it and are aware of the possible implemications.

#exec stream tcp nowait root /usr/libexec/tcpd rexecd
#ident stream tcp wait root /usr/libexec/tcpd identd -w -t120

Now, still more information you didn’t ask for… I’m not clear on your rational about ditching the FTP setup. It’s a total mess, but FTP and email are a common means of swapping data amongst mainframes, minis, and PCs. It’s 30 year old technology, but everyone does it and it works. Could you instead do something on the Mac Side to recognize the receipt of a new file via FTP more quickly or process it faster?

If you can’t find a way to do remote procedure calls from the AS400, perhaps you could consider a “middleman” solution. For example, queue data, requests, etc. to a database table. If you’re running db2, you can get at it from the Mac. This isn’t any faster than FTPing stuff around, but it’s way more reliable since it keeps lining the work up even if your Mac or the network are down.

If you want to have a conversation about it, feel free to drop me a line, but we should probably take it off the forum since we’re getting pretty far off the AS topic.