I am trying to run some SQL's using Rexx. I want to run some dynamic SQL's in a Rexx code. I do know how to run Static SQL's using DSNREXX.
Can somebody tell me how to run Dynamic SQL's using DSNREXX.
The problem here is that I get a RC=12 REASON=00F30006 for the DSNALI open, & a RC of -3 for options sqlca sqlda. The £rxtdb2_ssid is equal to DSN1 which is not a DB2 SYSID in my shop. If I do change it to DQA0 (The DB2 subsystem where i want to run the SQL's), the code changes to DSNALI OPEN RC=8 REASON=00F30034.
Any pointers would be real help for me.
Can somebody tell me how to run Dynamic SQL's using DSNREXX.
Code:
call rxsubcom 'add', 'ostsql', 'rxtasql2'
say 'RXSUBCOM RC='rc 'REASON='reason
if rc > 4 then do
say 'RXSUBCOM failed. DB201 Terminating.'
exit
end
if db2info('defaults') <> 0 then do
say 'DB2INFO call failed. RC='rc
exit rc
end
call dsnali 'open', £rxtdb2_ssid, 'rxtcs'
say 'DSNALI OPEN RC='rc 'REASON='reason
if rc <> 0 then do
say 'OPEN FAILED. DB201 Terminating.'
exit
end
address ostsql "options sqlca sqlda"
sqlcmd = arg(1)
address ostsql
s = sysvar('syscpu')
sqlcmd
e = sysvar('syscpu')
say 'ADDRESS SQL RC='rc 'REASON='reason 'TOTAL CPU='e-s
if rc <> 0 then
exit
The problem here is that I get a RC=12 REASON=00F30006 for the DSNALI open, & a RC of -3 for options sqlca sqlda. The £rxtdb2_ssid is equal to DSN1 which is not a DB2 SYSID in my shop. If I do change it to DQA0 (The DB2 subsystem where i want to run the SQL's), the code changes to DSNALI OPEN RC=8 REASON=00F30034.
Any pointers would be real help for me.