Is your program finishing correctly, or is it ending on some type of error (return-code or error-code not = zero). You might want to add some audit trail elements into your program (such as start date/time, number of input records read, number of records written out to each file, processing errors?, bypassed records, etc.).
I don’t know if you are reading the input file sequentially or non-sequentially (although I suspect you are processing most records based on the input file size). You might have sequence errors in your input file which could cause your processing logic to be incorrect (the key sequence of the 2300 record is lower than the key sequence of record 2299).
If you are always terminating at about the same time, I would suspect it’s the same problem each time.
You mentioned your session terminates – perhaps you need to increase your session idle time or put parameters on your program to extend the CPU time, or increase the program’s CPU priority.
Perhaps your program logic is in a loop and the system is cancelling your application because it no longer is using CPU cycles, or using too many of them?
There are many possible errors that may be causing your problem. Look at some of the common ones or those that you think might be the culprits and build into your application, information to help solve this issues.
I have used techniques like this to solve difficult and ‘stupid” programming errors.