Kunal Roy
Kunal Roy

Reputation: 787

Controlling Commit and Rollback in sqlrpgle

Hi can some one tell me how to control the commit and rollback in a SQLRPGLE.

Upvotes: 0

Views: 1446

Answers (1)

Charles
Charles

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

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

Related Questions