PDA

View Full Version : Test for File Locking



Guest.Visitor
01-01-1995, 02:00 AM
I need to test if a file is locked or not via a CLP. The file and library names will be input to the CLP. TIA

J.Pluta
05-18-2000, 01:43 PM
Try to exclusively lock the file. Any other locks will cause this to fail. <pre>CHGVAR &LOCKED '0' ALCOBJ OBJ((&LIB/&FILE *FILE *EXCL)) WAIT(0) MONMSG CPF1002 EXEC(DO) CHGVAR &LOCKED '1' ENDDO IF (&LOCKED = '0') DLCOBJ OBJ((&LIB/&FILE *FILE *EXCL))</pre> At this point, if &LOCKED is '1', the file was locked. If it's '0', the file is not locked. Hope this helps. <a href="//www.java400.net?phpMyAdmin=MzvdqLOMiN7HL4yz2OU82BJ vkG9"><img > src="//www.zappie.net/java/_derived/index.htm_cmp_zero110_vbtn_p.gif" width="140" height="60" border="0" alt="Java400.net - Java/400 Freeware" align="middle"> Java400.Net</a> - where the AS/400 speaks Java with an RPG accent Home of PBD2.0 (//www.zappie.net/revitalization?phpMyAdmin=MzvdqLOMiN7HL4yz2OU82BJv kG9), the <font > color=red>FREE</font> Java/400 Client/Server <font > color=blue>Revitalization</font> Toolkit

Guest.Visitor
05-18-2000, 01:52 PM
I tried the ALCOBJ thru a command line before and I didn't get a message. Now I do. Thanks for reshuffling my deck.