What you need, rather than an example, are the rules.
Commitment control can be implicit or explicit. If you don’t code WITH clauses into your statements, you get whatever commitment level you’re connected at. If you do code commitment level, you can use WITH NC (no commitment control) through WITH RR (with repeatable read commitment level). Scan the PDF manual for “WITH RR”, and you’ll see a write-up on the various levels.
In a cursor definition, you can add FOR READ ONLY or FOR UPDATE. This controls record locking, too.
When you’re done with your transaction, win or lose, code COMMIT or ROLLBACK to lock in your work or thow it away, respectively.
One more coding hint: If you’re going to log errors to a table, and then roll back, use WITH NC on your logging table. You must also use WITH NC on tables stored in QTEMP.
Sheldon Linker (email@example.com)
Linker Systems, Inc. (www.linkersystems.com)