Reputation: 787
Hi can some one tell me how to control the commit and rollback in a SQLRPGLE.
Upvotes: 0
Views: 1446
Reputation: 23823
Depends on what you mean by control...
There's the COMMIT and ROLLBACK statements
if someerror;
exec SQL rollback;
else;
exec SQL commit;
endif;
You can control the level of commitment control used by default for the entire module via
CRTSQLRPGI xxxx COMMIT(*CHG)
exec SQL set option commit=*CHG;
Note that there can be only one SET OPTION
in the module and it must physically be the first SQL statement see in the source file.
Lastly, for any given SQL statement, you can override the default commitment level by using the WITH <xxx>
isolation–clause.
insert into mytable (fld1, fld2)
values ("Hello", "World")
with CHG;
Upvotes: 6