Hi Tomasz,
On 11/18/2010 9:29 AM, Tomasz SkorÅa wrote:
We try to run an perl script on AS400 inCL or RPG program, is it
possible? Which command should be use?
I have perl installed, and I can run some scripts. I don't really use
it, but it's here and seems to run. So, yes, I'd say it's possible.
I'm not sure I understand what you mean by "which command should be
use"? The command is 'perl' -- but it's not a *CMD object. It's a
Unix program (Or, you could say it's a 'Unix command') and must be run
from PASE.
I just download and install Licensed program 5799PTL and now I can see in LICPGM
5799PTL *INSTALLED IBM Tools for Developers for i5/OS
Great! So you've already installed it. (Jumps for joy.)
When we call the same script from QSH screen - its work, but how to call it within CL/RPG?
The QSH command has a CMD() parameter. So, from CL, you can do:
QSH CMD('cd /myperldir && perl myscript.pl')
It's no different from any other QShell or PASE utility. There are a
bazillion different caveats, options, techniques, etc. Teaching you the
entire QShell environment in an e-mail would be like teaching you the
entire ILE environment in an e-mail...
So hopefully the above is enough to get you started, and remember,
Google is your friend. (But also your enemy!)
When we try call command in qsh:
/QOpenSys/QIBM/ProdData/DeveloperTools/perl
We get message:
qsh: 001-0017 Command /QOpenSys/QIBM/ProdData/DeveloperTools/perl not executable.
That's because /QOpenSys/QIBM/ProdData/DeveloperTools/perl is not a
program, it's a directory. You can't run a directory. (Just as you
can't CALL a library in the native enviromnent -- CALL QGPL won't work,
either.)
You _should_ have link to perl in /QOpenSys/usr/bin (or, at least, I
do...) So if /QOpenSys/usr/bin is in your PATH you can run it directly.
Just type: perl your-script-name
If /QOpenSys/usr/bin is not in your PATH, then you should add it. to
your PATH. For example, as a test, you can run the perl program and see
it's version by doing this:
QSH CMD('PATH=$PATH:/QOpenSys/usr/bin && perl -v')
The part before the && adds /QOpenSys/usr/bin to your path temporarily.
The 'perl -v' part runs perl with the -v switch, telling it to print
it's version information.
What does it mean - perl was installed incorrectly?
Do yu have some clear monual for installing/using perl on as400?
Not sure if anyone has written a manual on this or not...? Never looked
for one.
As an Amazon Associate we earn from qualifying purchases.