Job is using *JOB as the scope, and *CHG as Lock Level.

I ran a little test using a simple CL and 2 RPG.
CL:
STRCMTCTL LCKLVL(*CHG) CMTSCOPE(*JOB)
CALL PGMA
CALL PGMB
COMMIT
ENDPGM

PGMA:
Open FILE1 with COMMIT
Chain to a record with unique key
change value of non-key field to 'PGMA'
Update record
Return

PGMB:
Open FILE1 with COMMIT
Chain to a record with same unique key
change value of non-key field to 'PGMB'
Update record
Return

Ran the CL under debug in one session and checked the job and file in
another session. Here is what happened:

Before calling PGMA: no lock on FILE1 record. The record shows XXXX in the
non-key field (original value of the field). Could change the record being
accessed in the RPG programs.

After returning from PGMA, before calling PGMB: Job shows lock on FILE1
record. The record shows PGMA in the non-key field. Unable to change the
record.

After returning from PGMB, before COMMIT: Job shows lock on FILE1 record.
The record shows PGMB in the non-key field. Unable to change the record.

After COMMIT: no lock on FILE1. The record shows PGMB in the non-key field.
Could change the record being accessed in the RPG programs

Ran the same thing again, but exited the CL before COMMIT. no lock on FILE1
record. The record shows XXXX in the non-key field (original value of the
field). Could change the record being accessed in the RPG programs.



On Wed, Feb 23, 2022 at 1:29 PM Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
wrote:

What commitment level are you using?

Mit freundlichen Grüßen / Best regards

Birgitta Hauser
Modernization – Education – Consulting on IBM i


"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
„Train people well enough so they can leave, treat them well enough so they
don't want to.“ (Richard Branson)


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Vinay
Gavankar
Sent: Mittwoch, 23. Februar 2022 18:25
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Record Lock under Commitment Control

So what does the below mean?

I found this under IBMs Commit Lock Level documentation:
Within the same job, a program can change a record that has already been
changed within the current transaction as long as the record is accessed
again using the same commitment definition. When using the job-level
commitment definition, the access to the changed record can be made from a
program running within any activation group that is using the job-level
commitment definition.

I can only update the record only in the same program? Doesn't it kind of
defeat the purpose of 'transaction'?

On Wed, Feb 23, 2022 at 12:14 PM Rob Berendt <rob@xxxxxxxxx> wrote:

There is no "other" If it's locked, it's locked.
<snip>
even though it is kept locked for other jobs or programs </snip>

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600
Mail to: 7310 Innovation Blvd, Suite 104
Ft. Wayne, IN 46818
Ship to: 7310 Innovation Blvd, Dock 9C
Ft. Wayne, IN 46818
http://www.dekko.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-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 Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-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 Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-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.