Default action for DB2 connections is to issue a commit if the application terminates normally, and a rollback if the termination is abnormal. And yes, that means that if you have done 100 inserts or updates, all rows are restored to the state they were in when the program started.
If you want to maintain integrity between files and (DB2-) databses in an environment, you have to execute your applications in a DB or DB/DC environment like IMS or CICS. IMS can execute batch programs in BMP or DBB mode.
DB/DC processing is also often called TP environments, transaction processing. Here, 1 transaction is normally defined as 1 logical unit of work, that can be committed or rolled back based on the termination of the transaction.