Charles, thank you for that explanation. That helps quite a bit. I knew I could start journaling w/out using commitment control. I didn't know that I could still use commitment control in a program that set commit=*none.

And thank you to everyone for all of the input & suggestions. It seems like commit control is the only way to "undo" a transaction in this case.

Greg

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Charles Wilt
Sent: Monday, May 16, 2022 3:31 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: How to Undo an SQL Insert

You still seem to be confusing journaling and commitment control...

While you can't use commitment control without journaling, you can journal
a file without also having to use commitment control.

Every place I've ever worked, journalled basically all their files. Only a
few newer or updated programs used commitment control.

STRJRNPF is not going to cause any existing or new programs to throw
(exception) "messages all over".

The only side effects of journaling
- disk space usage for the receivers..
- slight overhead for INSERT/UPDATE/DELETE (aka writes but NOT READs)

The latter is noticeable when you've got a batch job doing 10's or 100's of
thousands of writes.
You can estimate the size of the receivers pretty easily.
https://www.ibm.com/docs/en/i/7.4?topic=storage-estimating-size-journal-receiver-manually
And start out journaling *AFTER images only.

As far as the Service program module with COMMIT(*NONE)...easy peasey.
Leave the module like it is, in the statement(s) where you want to use
commitment control, add WITH CHG; to the end of the statement.

INSERT INTO <...> WITH CHG;

Those statements and only those statements will use commitment control.


Charles




On Mon, May 16, 2022 at 10:03 AM Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

X2. If anyone knows how to get the RRN for certain, that would solve my
issue.

The legacy ERP does not have ANYTHING journaled... the transaction files
do not have a unique key on the PF or LF.

I understand what everyone is saying about journaling. No convincing
needed. But I cannot simply "turn it on" and risk messages all over the
given all the other programs that touch this file.

I'm also concerned about service program procedures (in the same module
even) that have COMMIT=*NONE. I'm not sure how to handle that.

If I was certain I could turn journaling on for this file, without
creating a host of other issues, I would.

Open to suggestions

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of John
Rusling via RPG400-L
Sent: Monday, May 16, 2022 8:42 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: John Rusling <JRusling@xxxxxxxxxxx>
Subject: RE: How to Undo an SQL Insert

I find that interesting Gad, thanks.

If -anyone- on the list knows, I for one would appreciate 2 things -
1. -IF- it is possible . . .
2. An example (syntax) of getting the just-inserted record RRN or Row
Number.

Here's the syntax to get the just added Id Column for a record,
immediately after insert or write, from an rpg program -

exec sql set :gOBFTKey = Identity_Val_Local() ;

Just to get the sharing juices flowing on Monday morning.
(heh heh I had to search source to find MY example. . . which I got from
someone else :--)

Thanks,
John

I believe it is possible to get the RRN (or is it Row Number) of the
just-inserted
record using get diagnostics immediately following the 1st insert.

You can then delete that record, if needed, using the RRN

HTH
Gad
--
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 ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2022 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.