Hi Patrick,

There is no UNLOCK TABLE command in SQL (not even in Release 7.6)
You may use the Deallocate Object (DLCOBJ) CL command

... here is the current documentation about releasing the lock:

Locks obtained: Locking is used to prevent concurrent operations.
The lock is released:
? When the unit of work ends, unless the unit of work is ended by a COMMIT
HOLD or ROLLBACK HOLD
? When the first SQL program in the program stack ends, unless
CLOSQLCSR(*ENDJOB) or CLOSQLCSR(*ENDACTGRP) was specified on the CRTSQLxxx
command
? When the activation group ends
? When the connection is changed using a CONNECT (Type 1) statement
? When the connection associated with the lock is disconnected using the
DISCONNECT statement
? When the connection is in the release-pending state and a successful
COMMIT occurs
You may also issue the Deallocate Object (DLCOBJ) command to unlock the
table.
Lock wait time: Conflicting locks already held by other application
processes will cause your application
to wait up to the default wait time of the job.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser
Modernization ? Education ? Consulting on IBM i
Database and Software Architect
IBM Champion since 2020

"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)
"Learning is experience ? everything else is only information!" (Albert
Einstein)


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik
Schindler via MIDRANGE-L
Sent: Monday, 23 March 2026 21:38
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Patrik Schindler <poc@xxxxxxxxxx>
Subject: [V4R5][SQL] Lock and Unlock Tables

Hello,

I have found that you can place an exclusive lock tables in V4R5 like this:

LOCK TABLE [tablename] IN EXCLUSIVE MODE

However, I was unable to find out how to remove this lock from within SQL.
There is no UNLOCK TABLE SQL command.

Any hints?

:wq! PoC

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


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-2026 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.