Closed abmusse closed 8 years ago
Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).
Closing this thread in favor of this one on db2util project.
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
Ok, the project is up. Make file is gcc. I provided a Yips link to a compiled 'test version'. We should move any chat about this tool to the db2util issues.
Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).
Here's the new litmis/db2util repo. I've made you an admin so you should be able to clone/push.
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
Start a new litmis project called 'db2util'. I started your shell toy this afternoon ... looking good.
#!shell
bash-4.3$ make
gcc -g -I. -I/usr/include -I.. -c db2util.c
gcc -g db2util.o -L. -lpthreads -liconv -ldl -lpthread -ldb400 -o db2util
bash-4.3$ db2util "select * from QIWS/QCUSTCDT where LSTNAM='Jones' or LSTNAM='Vine'"
"839283","Jones ","B D","21B NW 135 St","Clay ","NY","13041","400","1","100.00",".00"
"392859","Vine ","S S","PO Box 79 ","Broton","VT","5046","700","1","439.00",".00"
"392859","Vine ","S S","PO Box 79 ","Broton","VT","5046","700","1","439.00",".00"
bash-4.3$ db2util "select * from QIWS/QCUSTCDT where LSTNAM='Jones' or LSTNAM='Vine'" json
{"records":[
{"CUSNUM":"839283","LSTNAM":"Jones ","INIT":"B D","STREET":"21B NW 135 St","CITY":"Clay ","STATE":"NY","ZIPCOD":"13041","CDTLMT":"400","CHGCOD":"1","BALDUE":"100.00","CDTDUE":".00"},
{"CUSNUM":"392859","LSTNAM":"Vine ","INIT":"S S","STREET":"PO Box 79 ","CITY":"Broton","STATE":"VT","ZIPCOD":"5046","CDTLMT":"700","CHGCOD":"1","BALDUE":"439.00","CDTDUE":".00"},
{"CUSNUM":"392859","LSTNAM":"Vine ","INIT":"S S","STREET":"PO Box 79 ","CITY":"Broton","STATE":"VT","ZIPCOD":"5046","CDTLMT":"700","CHGCOD":"1","BALDUE":"439.00","CDTDUE":".00"}
]}
bash-4.3$ db2util "select * from QIWS/QCUSTCDT where LSTNAM='Jones' or LSTNAM='Vine'" space
"839283" "Jones " "B D" "21B NW 135 St" "Clay " "NY" "13041" "400" "1" "100.00" ".00"
"392859" "Vine " "S S" "PO Box 79 " "Broton" "VT" "5046" "700" "1" "439.00" ".00"
"392859" "Vine " "S S" "PO Box 79 " "Broton" "VT" "5046" "700" "1" "439.00" ".00"
bash-4.3$
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
... skip db2 anything and call directly into xmlservice (memory driver) Would this work from chroot?
Yes and no.
Calling ILE PGMS, CMDS, *SRVPGMS, ... yes.
Call xmlservice shell functions like
Any wager at a guess of speed improvements?
Not a lot.
However, we have been working on an XMLSERVICE 2, which could run much faster.
Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).
... three French hens ... two turtle doves ... and ... a partridge in a pear tree.
:-) Christmas in July, I like it.
not avail - we do not have a shell-driver-db2-interface to iPlug today, but it is possible (db2 driver)
The mention of libdb400.a
triggered memory of the db2sock project. I am thinking that might be a good foundation.
not avail - you could also skip db2 anything and call directly into xmlservice (memory driver)
Would this work from chroot? Any wager at a guess of speed improvements?
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
I am wondering if we could/should develop a shell-itoolkit that goes directly against ... XMLSERVICE
From a shell language (bash, ksh, etc.) ...
available - You can already do this with curl and REST interface (rest driver)
not avail - we do not have a shell-driver-db2-interface to iPlug today, but it is possible (db2 driver)
not avail - you could also skip db2 anything and call directly into xmlservice (memory driver)
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
We already have open source/working SQL CLI API code in the ruby-ibm_db, so we could use that code. And then we could borrow code from the Linux system command for creating hooks into the compiled SQL CLI APIs.
... three French hens ... two turtle doves ... and ... a partridge in a pear tree.
What you really want is an equivalent db2 pase command that uses the libdb400.a driver. Yes it is complete possible.
Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).
Bummer.
I am wondering if we could/should develop a shell-itoolkit that goes directly against the SQL CLI APIs (invoking XMLSERVICE's iPLUGR4K
stored proc). It would remove the requirement for PHP/Ruby/Python/Node.js. We already have open source/working SQL CLI API code in the ruby-ibm_db, so we could use that code. And then we could borrow code from the Linux system command for creating hooks into the compiled SQL CLI APIs.
We could name the shell script itoolkit
and run it as follows:
$ itoolkit -cmd 'DSPJOBLOG'
...joblog output...
$ itoolkit -raw '<xml><script>...input...</script>'
<xml...><script>...output...</script>
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
I have a sinking feeling it's because it is somehow linked to /QSYS.LIB
Correct my sinking friend (blub, blub, blub, quicksand). PASE 'system' command calls *PGMs in /QSYS.LIB, which has been rendered not available in chroot. By the same token, anything qshell (qsh), will not work because it also is /QSYS.LIB.
Original report by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).
I thought I had asked you (@rangercairns) this before but couldn't find my question in any achives... should the PASE
system
command work in chroot? It isn't working for me and I have a sinking feeling it's because it is somehow linked to/QSYS.LIB
(which would obviously fail).