On 12 Mar 2013 12:07, fbocch2595@xxxxxxx wrote:
Any idea how to get details of how many records were deleted when
using RUNSQL in batch in a CLP? That would be nice. <<SNIP>>
I would still suggest writing the code to perform the dynamic SQL and
return the SQLERRD(3) to the invoker. I actually have a simple REXX
called EXECSQLSTM that I will post in another message, and that REXX
being invoked by a DELETEROWS command, for what I expect should have a
relatively simple CLP as CPP; noting: while the REXX can be a CPP, doing
so is more complicated for any escaped apostrophes in the input string.
Using the DELETEROWS command would basically replace the RUNSQL
invocation, so the CLP using DELETEROWS can obtain the number of rows
deleted; I'll probably code that as a completion message.
However, specifically for the RUNSQL...
One possible alternative [to the RTVMBRD and counting rows that would
be presumed to be updated; as in prior messages], if using commitment
control is an option [i.e. if the file is journaled], the DELETE can be
issued WITH UR and then the CLP could extract the number of "Record
Level" changes that are pending; i.e. the CLP could retrieve the same
information available from the interactive request:
WRKCMTDFN-> 5=Display-Status-> F6=Display-resource-status->
1=Select[resource=Record-Level]
Either of the following presumably would enable that [although I can
not verify the effects]:
RUNSQL SQL('DELETE from t18pf where joentt = ''CA'' and jojob =
''QZLSFILET'' and jopgm = ''QLESPI'' WITH UR') COMMIT(*NONE)
RUNSQL SQL('DELETE from t18pf where joentt = ''CA'' and jojob =
''QZLSFILET'' and jopgm = ''QLESPI'' ') COMMIT(*CHG)
Then after that SQL DELETE request runs under isolation:
- first: invoke the API(s) that would retrieve the information about
the commit resources, to get the number of rows that were changed by the
DELETE statement; left as an exercise for the reader
- second: issue the COMMIT of those pending resources
- third: issue ENDCMTCTL to delete the commit definition
As an Amazon Associate we earn from qualifying purchases.