following “classic” problem: I got a NAT3047 in Batch. NISNHQ is set to 6000. I’m doing an END TRANSACTION every 1000 records processed by my main program.
The reason is: There is a huge nested callnat-Structure called for every record. And ist not predictable how many additional records will be changed inside the nested callnat structure. In most cases no records are changed. In some rare cases there are hundreds of records changed for one record in the main program.
Solution No. 1 would be of course: Implementing a counter as a paramter used by all programs in the nested structre. In my case that would mean to change (and to test) > 30 subprograms. Not good.
Solution No. 2 would be: END TRANSACTION for every record read by the main program. This would result in > 1,000,000 senseless transactions. Runtime would rise. Not good.
Solution No. 3 would be to determine (in the main program) how many records are held by the current session, and to do an END TRANSACTION if more than (e.g.) 1000 records held. But the question is: How to do this? Is there any system variable or USR-Call to do this?