|
Today I wrote a simple CL program that needs to take *EXCL control of a file. When this work starts, the job should have NO members at all, and the job will go adding some members. At the end of the job, all members will be removed (normal end of work). When allocating (ALCOBJ) an object of type *FILE, you can specify no member in the command (then Allocate is done on the whole object) or you can also specify the member you want to specifically allocate. In this case you get a *SHRRD on the file and a *EXCL on the Members data. So far, so good. But what happens if the file has no members at all? I just want to make sure nobody else is going to be able to do anything to that file while I'm working on it. So ...? Doing an ALCOBJ (in my case, for *EXCL use) of a file which has no members at the time ALCOBJ is done, you get two messages: - Diag CPF0944 : file has no members... - Escape CPF1085 : Object has NOT been assigned (not sure about the translation to english, but what it says is you have NOT got the allocation requested). Is this how it is supposed to work? ("working as designed" ?) How can I get *EXCL control of a file with no members? One can think of checking for members in the file before the ALCOBJ. If none, add a dummy member. Then do the ALCOBJ, then RMVM the dummy member... Seems simple, although "poor" , isn't it? But I've done it , and once done, you have NO locks on the file anymore! So that's no solution either. So, how can I get *EXCL control of a file with no members? TIA -- ------------------------- Antonio Fernandez-Vicenti afvaiv@wanadoo.es
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.