petecm99 has asked for the wisdom of the Perl Monks concerning the following question:

Benevolent Monks...

I need to be able to execute a command on an I-series server from a Windows XP perl script. Is there a module to do this?

In a nutshell...
1. Login to I-series from Windows PC
2. Execute a CL or RPG program (e.g. CALL LIBRARY/PROGRAM)
3. Get a successfully completed or abort return code
4. Perhaps execute another program based on success msg
5. Log off

Many thanks for your venerable wisdom!

Replies are listed 'Best First'.
Re: I-series commands from Windows script
by Corion (Patriarch) on Jun 21, 2010 at 20:21 UTC

    If you are lucky and have the IBM Personal Communications program installed (a quite good 3270 emulator), you can automate that using Win32::OLE. It has the "HLLAPI" which allows you to wait until certain text appears on-screen for example.

    If you don't have it but still have 3270-access, maybe you can use s3270 and/or x3270, two other 3270 emulators.

      Thanks Corion,

      It looks a bit involved, but I'm still slogging through it - I just got the Sourceforge version of the 3270. Even if I get it to work through OLE, not sure how I'd go about making it into a nicely wrapped standalone app. Perhaps I can just bind the 3270 emulator into the perl exe...wish there was an easier way!

      petecm99

        What I really like about the IBM 3270 emulator is that it is interactive so you get to watch where your script gets stuck and you can also easily inspect what your script sees when it makes decisions.

        I have a nicely wrapped 3270 library, but I developed it for $work so I'm not really sure that I can release it onto the CPAN even though the "main" 3270 application just got decommissioned. But the successor application also got 3270 access because deep down it still runs on an IBM host+database, so the framework will still stay in place, just in case the fancy new web interface (or XML interface) doesn't work out...

Re: I-series commands from Windows script
by VinsWorldcom (Prior) on Jun 22, 2010 at 11:16 UTC

    It's not a Perl module, but couldn't you try something like psexec wrapped in a Perl script ('system' command) or even a batch/Powershell script?

    UPDATE: After msg from OP, I realized I read it wrong, we're logging in *from* Windows, not necessarily *to* Windows. PSEXEC will indeed only work on Windows systems.