Avoiding FetchResultStopLimit errors in Java or scripts

Today I had to face an issue deleting a large set of records from a Maximo table using an automation script. My script was something like this.

mboSet = MXServer.getMXServer().getMboSet("MYTABLE", mbo.getUserInfo())
mboSet.deleteAll()
mboSet.save()

Unfortunately the table I had to purge (MYTABLE in the example) was having more than 5000 rows so when I launched the script I got the following error.
BMXAA7387E - While attempting to retrieve 5001 of MYTABLE, the operation was terminated because the preset limit 5000 was exceeded for retrieving MYTABLE into a single set. Reduce the number of selected objects for the operation.
The simple solution would have been to increase the mxe.db.fetchResultStopLimit Maximo system parameter as documented in this post but I was looking for a more elegant solution.
Searching a little in the Maximo Java code i discovered the MboSet.setLogLargFetchResultDisabled() method that was exactly what I was looking for. Calling this method before the bulk operation will disable logging of large fetch result set to avoid FetchResultLogLimit errors. As a positive side effect it also increased the performances a lot.

The updated script now works like a charm.

mboSet = MXServer.getMXServer().getMboSet("MYTABLE", mbo.getUserInfo())
scSet.setWhere(where)
# disable logging of large fetch result set to avoid FetchResultLogLimit errors
mboSet.setLogLargFetchResultDisabled(True)
mboSet.deleteAll()
mboSet.save()

Labels: , ,