Thread: DB2

Do I need to COMMIT in a COBOL batch DB2 program?

Started by Jordan • user3 replies172 viewsLast activity 3 weeks ago
Post #1
1 votes
Jordan
Reputation
12
Posts: 32
Joined: May 2, 2026, 11:10 AM
Posted: Jul 23, 2026, 8:29 AM

Updated a bunch of rows in a loop. Program ended fine. Did DB2 save them automatically or did I forget something important?

Post #2
0 votes
Elena
Reputation
391
Posts: 19
Joined: Apr 18, 2024, 9:30 AM
Posted: Jul 23, 2026, 10:29 AM

Batch usually needs explicit COMMIT (or your shop framework does it). If you never commit and the job ends without one, behavior depends on how the connection closes - do not rely on luck.

Also commit every N rows on big updates so you do not hold locks forever.

Post #3
0 votes
Sandra
Reputation
198
Posts: 17
Joined: Oct 15, 2024, 8:30 AM
Posted: Jul 24, 2026, 9:29 AM

Ask your team for the standard commit pattern. Some shops wrap it in a copybook paragraph.

You must be signed in to reply to this thread