Discussion:
Using db2 under PASE
(too old to reply)
Knut Berg
2006-03-09 08:49:21 UTC
Permalink
Hi,
when running strqsh it's possible to use the db2 command which is
quite practical for piping the output to emails etc.
But if I try this under PASE (call qp2term) I only get this:
db2: cannot execute
Can it have something to do with multi-threaded environment?
Knut
George Timms
2006-03-10 00:47:25 UTC
Permalink
Post by Knut Berg
when running strqsh it's possible to use the db2 command which is
quite practical for piping the output to emails etc.
db2: cannot execute
Can it have something to do with multi-threaded environment?
It might, but what exactly are you trying?

I've never heard of the "db2 command", but it is presumably an MI (perhaps
ILE) program that is likely to be found by QShell via a symbolic link in
/usr/bin. i5/OS PASE shells don't directly understand/run MI programs, but
you can call an MI program using the i5/OS PASE "system" or "qsh" utility.

Assuming "db2" is an MI program object in library "xxx", you could enter
this on the ksh (Korn shell) command line that is the default for QP2TERM to
run the CL "call" command for the specified program:

system 'call xxx/db2'

If "db2" is symbolic link /usr/bin/db2, this command may also work from the
QP2TERM command line:

qsh -c /usr/bin/db2

If that works, you can make the invocation "automagic" by adding this
symbolic link:

ln -s /QOpenSys/usr/bin/qsh /QOpenSys/usr/bin/db2

With this symbolic link, you will be able to simply type "db2" from the
command line presented by QP2TERM (because the i5/OS PASE "qsh" utility
recognizes when it is invoked by another name and searches for a link of the
same name in /QOpenSys/usr/bin and tries to run it as an MI program)
--
George Timms
IBM Rochester
Knut Berg
2006-03-10 07:47:30 UTC
Permalink
Post by George Timms
Post by Knut Berg
when running strqsh it's possible to use the db2 command which is
quite practical for piping the output to emails etc.
db2: cannot execute
Can it have something to do with multi-threaded environment?
It might, but what exactly are you trying?
I've never heard of the "db2 command", but it is presumably an MI (perhaps
ILE) program that is likely to be found by QShell via a symbolic link in
/usr/bin. i5/OS PASE shells don't directly understand/run MI programs,
but you can call an MI program using the i5/OS PASE "system" or "qsh"
utility.
Assuming "db2" is an MI program object in library "xxx", you could enter
this on the ksh (Korn shell) command line that is the default for QP2TERM
system 'call xxx/db2'
If "db2" is symbolic link /usr/bin/db2, this command may also work from
qsh -c /usr/bin/db2
If that works, you can make the invocation "automagic" by adding this
ln -s /QOpenSys/usr/bin/qsh /QOpenSys/usr/bin/db2
With this symbolic link, you will be able to simply type "db2" from the
command line presented by QP2TERM (because the i5/OS PASE "qsh" utility
recognizes when it is invoked by another name and searches for a link of
the same name in /QOpenSys/usr/bin and tries to run it as an MI program)
Marvellous George!
It worked like a charm.
The mostly unused little gem, the db2 command, gives you full access to the
i5 database and works like its equivalent on db2 udb for linux and windows.
Great for quick extracts from the database and even runs nicely via rexec
like this:
rexec -a -l uid -p paswd host "qsh cmd('db2 \"select * from lib.table\"')"
Loading...