IBM Support

Sample Program to List Lock Information for IFS Objects

Troubleshooting


Problem

There is no command on the IBM i OS that allows you to do the IFS equivalent of WRKOBJLCK for the native file system.

Resolving The Problem

There is no command on the IBM i OS that allows you to do the IFS equivalent of WRKOBJLCK for the native file system. However, the following command source and RPGLE source will create a command that allows you to view lock information for an IFS directory or stream file. The output of the command will be a spooled file that contains information about jobs that are holding locks on an IFS object (file or directory) and the reason they have the lock.

Caution: This is an example only. IBM accepts no responsibility for its correctness.

Note: Unless otherwise specified, parameters should be passed as null-terminated strings.

Command source: Command name WRKLCK.

CMD
PARM       KWD(PATH) TYPE(*CHAR) LEN(500)            


RPGLE source: Program name WRKLCK

Dspaceloc         S              3P 0                                                          
 DPATH             S            500                                                            
 DCMD              S           1024    INZ(' ')                                                
 DQUOTE            S              1    INZ('''')                                                
 DCMDL             S             15  0 INZ(1024)                                                
 DQCMDEXC          PR                  EXTPGM('QCMDEXC')                                        
 DCMD                          1024A   OPTIONS(*VARSIZE) CONST                                  
 DCMDL                           15p 5 CONST                                                    

 C     *ENTRY        PLIST                                                                      
 C                   PARM                    PATH                                              
 C*                  PARM                    RTN                                                

  /FREE                                                                                        
     spaceloc = %scan(' ':path);                                                                
     path = %subst(path:1:spaceloc);                                                            
     cmd='CALL QP0FPTOS PARM(*LSTOBJREF '+ QUOTE + %trim(path) + QUOTE + ' +                    
            *FORMAT2)';                                                                        
    QCMDEXC (CMD : %SIZE(CMD));                              
    *INLR = *ON;                                              
 /END-FREE

[{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":"Integrated File System","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"Version Independent;7.3;7.2.0;7.2;7.1.0;7.1;6.1.0;6.1;5.4.0","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}},{"Product":{"code":"SSC3X7","label":"IBM i 6.1"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSC52E","label":"IBM i 7.1"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSTS2D","label":"IBM i 7.3"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":null}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSC5L9","label":"IBM i 7.2"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":null}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

Historical Number

607928008

Document Information

Modified date:
18 December 2019

UID

nas8N1011392