× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You wouldn't necessarily need it before every insert, update, delete...

I'd expect that you'd set it when the program starts, and wouldn't need to
change it during that invocation of the program.

Now if you've got your SQL statements in different *SRVPGM procedures, such
that one call might be made with commit and another without, then yeah,
you'd need to do the SET TRANSACTION ISOLATION LEVEL in the procedure prior
to the insert/update/delete statement.

As far as which isolation level, take a look here
https://www.ibm.com/docs/en/i/7.4?topic=level-comparison-isolation-levels

For your purposes, take a look at the lock level you used on the STRCMTCTL
command prior to running the RPG program.
*CHG --> Isolation Level READ UNCOMMITTED (UR)
*CS --> Isolation Level READ COMMITTED (CS) (aka CURSOR STABILITY)
*ALL --> Isolation Level REPEATABLE READ (RS)(aka READ STABILITY)
--> Isolation Level SERIALIZABLE (RR)(aka REPEATABLE READ)

The last two are confusing, basically because the SQL standards don't quite
line up with what Db2 for i had originally.
Just remember that SERIALIZABLE (RR), locks the entire table.

For most purposes, READ UNCOMMITTED is what you're used to. But READ
COMMITTED is sometimes helpful.

HTH,
Charles

On Thu, Sep 22, 2022 at 9:05 AM Jack Prucha <Jack.Prucha@xxxxxxx> wrote:

So this would be something like:

If parmCommit = '0'; // no commit control
EXEC SQL SET TRANSACTION ISOLATION LEVEL NO COMMIT;
Else; // yes commitment control
EXEC SQL SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
EndIf;

This would be required before each insert, update or delete statement?

I don't understand the differences between the options READ COMMITTED,
REPEATABLE READ and SERIALIZABLE.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Charles
Wilt
Sent: Thursday, September 22, 2022 10:39 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Conditional Commit with Embedded SQL

With dynamic SQL, ...just add the appropriate WITH xxx clause at the end
of the statement..

With static SQL or dynamic SQL, you can use the SET TRANSACTION statement
to change the commitment level at run-time.

HTH,
Charles

On Thu, Sep 22, 2022 at 7:51 AM Jack Prucha <Jack.Prucha@xxxxxxx> wrote:

We have been using for years the F-Spec Commit keyword to
conditionally set on or off commitment control. In some cases a web
process using commitment control executes programs via a stored
procedure which passes a '1' in a parameter list to turn on commitment
control. Green screen programs not using commitment control call the
same program with that parameter set to '0'. The called program opens
the files with commitment control turned on or off.

Now, we have a new RPG program using embedded SQL Insert and Update. Is
there some straightforward way to set commitment control on or off at
execution time?

TIA


Jack Prucha
NCSP529 Programming Team Supervisor

College Foundation, Inc.

This email, including any documents, files, or previous email messages
attached to it, has been sent from an email account of College
Foundation Inc., (CFI) and may contain confidential, proprietary, or
legally privileged information belonging to CFI. If you are not the
intended recipient, any dissemination, distribution, or copying of
this email or its attachments is strictly prohibited. If you have
received this email in error, please immediately notify the sender by
email and destroy the original email and any attachments.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.