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.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.