Using qsh
Hi,
With version 1.9.8, I tried to use qsh.
It works for a simple commande like ls, but I got an error with /QIBM/ProdData/OS/WebServices/V1/server/bin/listWebServices.sh
**free
ctl-opt actgrp(*new) ;
dcl-s myXmlIn char(4096) inz ;
dcl-s myXmlOut char(4096) inz ;
// Doesn't work
myXmlIn =
'<?xml version="1.0"?><script><qsh rows="on">' +
'/QIBM/ProdData/OS/WebServices/V1/server/bin/' +
'listWebServices.sh -server ''ws_test''' +
'</qsh></script>' ;
exec sql call XMLSERVICE/iPLUG4K('*na','*here',:myXmlIn,:myXmlOut);
// Works fine
myXmlIn =
'<?xml version="1.0"?><script><qsh rows="on">' +
'ls' +
'</qsh></script>' ;
exec sql call XMLSERVICE/iPLUG4K('*na','*here',:myXmlIn,:myXmlOut);
return;
myXmlOut contains :
<?xml version="1.0"?>
<script>
<qsh rows="on">
<error>*** error
/QIBM/ProdData/OS/WebServices/V1/server/bin/listWebServices.sh
-server 'ws_test'</error>
<error>202</error>
<version>XML Toolkit 1.9.8</version>
<error>
<status>202</status>
<errnoxml>1100014</errnoxml>
<xmlerrmsg><![CDATA[XML run pgm excp]]></xmlerrmsg>
<xmlhint><![CDATA[xml pase exec]]></xmlhint>
</error>
<error>
<status>202</status>
<errnoxml>1100014</errnoxml>
<xmlerrmsg><![CDATA[XML run pgm excp]]></xmlerrmsg>
<xmlhint><![CDATA[xml pase exec]]></xmlhint>
</error>
<jobinfo>
<jobipc></jobipc>
<jobipcskey>FFFFFFFF</jobipcskey>
<jobname>QPADEV000C</jobname>
<jobuser>QSECOFR</jobuser>
<jobnbr>158541</jobnbr>
<jobsts>*ACTIVE</jobsts>
<curuser>QSECOFR</curuser>
<ccsid>1147</ccsid>
<dftccsid>1147</dftccsid>
<paseccsid>0</paseccsid>
<langid>FRA</langid>
<cntryid>FR</cntryid>
<sbsname>QINTER</sbsname>
<sbslib>QSYS</sbslib>
<curlib>NB</curlib>
<syslibl>QSYS QSYS2 QHLPSYS QUSRSYS</syslibl>
<usrlibl>OUTILS QGPL QTEMP</usrlibl>
<jobcpffind>see log scan, not error list</jobcpffind>
</jobinfo>
</qsh>
</script>
I tried with using CDATA, several values for IPC and Ctl, qualifing by /usr/bin/sh.
Thanks Nathanaël
Comments (6)
-
Account Deleted -
@starbg, I think his context is different. He's trying to invoke a shell script from XMLSERVICE; which is his client in this scenario.
@nbonnet_gaia, take a look at these docs to see how error logging can be turned on.
-
reporter Aaron, you're right, my client is a ILE SQL RPG program in this case.
I think the problem comes from any qsh command with a ' (quote).
I modified the source of PLUGILE module, ileExec procedure in order to duplicate all quotes in the command :
cmdstr = 'STRQSH CMD(''' + '/usr/bin/qsh -c ''''' + %scanrpl( '''' : '''''' : %str(cmd:cmdLen)) // + %str(cmd:cmdLen) + ''''''')';
then it works !
Aaron, Bill, thanks !
-
Account Deleted Ok, added your change. I am assuming you tested to some level.
-
reporter Thanks Tony. I have validated some scripts.
-
Account Deleted - changed status to closed
fixed
- Log in to comment
Nathanaël, I have no official answer here (but just saw your report). The recommendation is generally to use a terminal app on your client computer to execute a shell with SSH. Here's a link to a Ryver discussion (enrollment link here) of the cross-platform one I'm currently using successfully.