Re: How to find wich program lock file record

dr2-8VsyYNX/[email protected] Thu, 02 Apr 2026 01:32:48 -0400
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Well, I think Birgitta posted this some time back:

What do you want to get? Which user locks the record?
The System Error Message, can be trapped in a program from the Program
Status Data Structure - Position 91 - 170.
The Error Message includes the qualifed job who locks the row.
So you only need to display the message.

Example: 

Code: 

DCL-DS PGMSDS  PSDS Qualified; 

   MsgTxt   Char(80)  Pos(91); 

End-DS 

Chain(E) YourKey YourFile; 

If %Status = '01218'    //Record Lock; 

   //Error Message incl. the qualified Job who holds the row is in
PGMDSD.MsgTxt 

EndIf;

====

And I think these are also references for similar conditions:

https://support.jda.com/s/article/How-to-handle-Record-locks-in-Green-screen?language=en_US


 ================================================================ 

https://www.mcpressonline.com/programming/rpg/avoid-record-lock-errors

---------------------------------------------------------------------------------------------------------

Enjoy....

On 2026-04-01 16:38, gio.cot via RPG400-L wrote:

> Hi all
> 
> In a job,  sometimes I have a problem with a record that remain locked and
> so i get CPF5032 "Record already locked to this job ; 
> 
> how i could find the program that take locked the record ??   
> 
> Keep in mimd that this file is under commitment control   ..
> 
> Thank in advance
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.