You can get it by using CL program.
By using WRKOBJLCK using parameters Object Name, Object Type and Output as *PRINT, You can get a spoolfile containing the List of users who are all locking the Object. Spool file will be with a default name of QPDSPOLK.
Create a Temporary flat file and copy the data in Spool file to Temporary file by using CPYSPLF command.
By using the Substring, You can compare the 2nd Position and 4th Position of Record.
If Second Position *NE Blank or Fourth Position *EQ Blank, We can skip the process and Read the file again,
If these two conditions are not satisfied, then By using Substring we can get the User ID(10 digits from, Position 17), Workstation ID(10 digits from position 4) & Job Number(6 digits from position 29)
Sample code will be like this.
<pre> CHGVAR VAR(&FIRST) VALUE(%SST(&QSPLF 2 1))
CHGVAR VAR(&FOURTH) VALUE(%SST(&QSPLF 4 1))
IF COND(&FIRST *NE ‘ ‘) THEN(GOTO CMDLBL(RCVF))
IF COND(&FOURTH *EQ ‘ ‘) THEN(GOTO CMDLBL(RCVF))
/* Retrieve Job, User and Job Number */
CHGVAR VAR(&JOB) VALUE(%SST(&QSPLF 4 10))
CHGVAR VAR(&USER) VALUE(%SST(&QSPLF 17 10))
CHGVAR VAR(&JOBNBR) VALUE(%SST(&QSPLF 29 6)) </pre>
Here RCVF is Label name for Reading a File & QSPLF in the Temporary file which we declare in CL.