常用二种方法
一 在CL中,可以先使用ALCOBJ命令來Lock一個OBJ,结束后再DLCOBJ,如果没有执行DLCOBJ,JOB结束后将自动释放。
根據不同的Lock state,會對檔案進行不同方式的Lock,可根據需要進行選擇:
1.*SHRRD::The lock state is shared for read,加鎖的作業只能讀,而其他作業可以讀或更新檔案。
2.*SHRNUP: The lock state is shared, no update ,加鎖的作業和其他作業都只能讀該檔案。
3. *SHRUPD: The lock state is shared for update.,其他作業可以讀或更新該檔案。
4.*EXCLRD: The lock state is exclusive, allow read,其他作業只能讀該檔案。
5.*EXCL:The lock state is exclusive, no read. 其他作業不能對該檔案做任何操作
二 可定义一个DATAARA
进入时在DATAARA中标识,结束后取消标识