Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iCmd5250 not working with DirectTransport #48

Closed
ranga543 opened this issue Feb 20, 2020 · 8 comments
Closed

iCmd5250 not working with DirectTransport #48

ranga543 opened this issue Feb 20, 2020 · 8 comments

Comments

@ranga543
Copy link

@kadler I tried with iCmd5250 but it seems to be throwing some kind of error
test.py

from itoolkit import *
from itoolkit.transport import DirectTransport

itransport = DirectTransport()
itool = iToolKit()
itool.add(iCmd5250('aspgroup_cmd', 'SETASPGRP ASPGRP(TEST)'))
itool.call(itransport)
cmd_out = itool.dict_out('aspgroup_cmd')

if 'error' in cmd_out:
  print ('test')
  print (cmd_out['error'])
  exit()
{'aspgroup_cmd': {'error': {...}}, u'error1': u" ?xml version='1.0'? xmlservice /sh /xmlservice ", u'error': u'*BADPARSE'}

Originally posted by @ranga543 in #47 (comment)

@ranga543
Copy link
Author

@kadler any idea ?

@kadler
Copy link
Member

kadler commented Feb 20, 2020

The error indicates that the XML returned from XMLSERVICE could not be parsed. What does itool.xml_out() show?, eg.

itool.call(itransport)
print(itool.xml_out())

@ranga543
Copy link
Author

@kadler No, luck I tried that as well it's giving following output

<?xml version="1.0" ?><xmlservice>
<error>*BADPARSE</error>
<error><![CDATA[ ?xml version='1.0'? xmlservice /sh /xmlservice ]]></error>
</xmlservice>

@kadler
Copy link
Member

kadler commented Feb 20, 2020

Could be running in to this problem: https://github.com/IBM/python-itoolkit#ilibcall-and-64-bit-support

You can try installing SI70667 or SI70668.

@ranga543
Copy link
Author

@kadler after installing SI70667 PTF we are getting following error

sh: syntax error at line 1 : `(' unexpected
<?xml version="1.0" ?><xmlservice><sh error="on" var="aspgroup_cmd">
</sh>
</xmlservice>

@kadler
Copy link
Member

kadler commented Feb 20, 2020

Oh, right. The way iCmd5250 is programmed, it doesn't support passing parameters...

@ranga543
Copy link
Author

@kadler I tried without parameters and it's returning

from itoolkit import *
from itoolkit.transport import DirectTransport
from itoolkit.lib.ilibcall import *

# modify iToolKit not include row node
itransport = DirectTransport()
#itransport = iLibCall()
itool = iToolKit()
itool.add(iCmd5250('aspgroup_cmd', 'SETASPGRP TEST', {'error': 'on'}))
itool.call(itransport)
cmd_out = itool.xml_out()
print (cmd_out)
<?xml version="1.0" ?><xmlservice><sh error="on" var="aspgroup_cmd">
</sh>
</xmlservice>

@kadler
Copy link
Member

kadler commented May 1, 2020

Calling SETASPGRP will never work as expected with iCmd5250 as this is merely a wrapper around iSh, calling /QOpenSys/usr/bin/system to execute the command. This will cause a new job to start, set the ASP group, then exit.

The issue related to quoting and passing arguments has been fixed and will be in version 1.7 when it gets released.

@kadler kadler closed this as completed May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants