python-itoolkit
python-itoolkit copied to clipboard
Improve irow handling for 5250 output parameters
Original report by Kevin Adler (Bitbucket: kadler, GitHub: kadler).
Retrieving output parameters is somewhat painful:
#!python
itool.add(iCmd('rtvjoba', 'RTVJOBA USRLIBL(?) SYSLIBL(?) CCSID(?N) OUTQ(?)'))
itool.call(itransport)
rtvjoba = itool.dict_out('rtvjoba')
if 'success' in rtvjoba:
print(rtvjoba['row'][0]['USRLIBL'])
print(rtvjoba['row'][1]['SYSLIBL'])
print(rtvjoba['row'][2]['CCSID'])
print(rtvjoba['row'][3]['OUTQ'])
you can fix it...
#!python
itool = iToolKit(irow=0)
itool.add(iCmd('rtvjoba', 'RTVJOBA USRLIBL(?) SYSLIBL(?) CCSID(?N) OUTQ(?)'))
itool.call(itransport)
rtvjoba = itool.dict_out('rtvjoba')
if 'success' in rtvjoba:
print(rtvjoba['USRLIBL'])
print(rtvjoba['SYSLIBL'])
print(rtvjoba['CCSID'])
print(rtvjoba['OUTQ'])
... but because irow is specified on the toolkit object instead of the iCmd object, it will break anything which actually returns rows. Should make it available on iCmd object (and make irow=0 the default for output parameters in the iCmd object).
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
This is a low priority, but will be considered in future release.