Last active
April 24, 2019 03:07
-
-
Save jkyeung/9e79fdfc3cdd4f690f91df76ed199336 to your computer and use it in GitHub Desktop.
Problem with iPgm parameters in python-itoolkit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itoolkit import iToolKit, iCmd, iPgm, iData | |
from itoolkit.transport import DatabaseTransport | |
from localutils import odbc_connection # uses pyodbc from my PC | |
def pgm1(trans): | |
itool = iToolKit(irow=False) | |
itool.clear() | |
itool.add(iPgm('pgm1', 'XPGM1', {'lib': 'MYLIB'})) | |
itool.call(trans) | |
print(itool.dict_out('pgm1')) | |
def pgm2(trans, a, b): | |
itool = iToolKit(irow=False) | |
itool.clear() | |
itool.add(iPgm('pgm2', 'XPGM2', {'lib': 'MYLIB'}) | |
.addParm(iData('in1', '3p0', str(a))) | |
.addParm(iData('in2', '3p0', str(b))) | |
.addParm(iData('out', '3p0', ''))) | |
itool.call(trans) | |
print(itool.dict_out('pgm2')) | |
transport = DatabaseTransport(odbc_connection()) | |
pgm1(transport) | |
pgm2(transport, 3, 5) | |
pgm1(transport) # this fails | |
print('Done.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*----------------------------------------------------------------* | |
D var1 s 3 0 inz(1) | |
D var2 s 3 0 inz(0) | |
D var3 s 3 0 | |
*----------------------------------------------------------------* | |
C if %parms > 0 | |
C eval var3 = var1/var2 | |
C endif | |
C return | |
*----------------------------------------------------------------* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*----------------------------------------------------------------* | |
C *entry plist | |
C parm in1 3 0 | |
C parm in2 3 0 | |
C parm out 3 0 | |
C eval out = in1 * in2 | |
C return | |
*----------------------------------------------------------------* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment