I'm looking for a way to retrieve the permissions for all of the objects in our IFS and place them in a DB2 file that I can use to manage them. I have been playing with the Qp0lGetAttr() API with an attribute type of 11, but I am struggling on manipulating the array that gets returned in the buffer. I haven't addressed how to do this for more than one object at a time. I would appreciate any help you could provide.
Have you seen the API description at IBM's website?
This describes the API and how to use it:
NOTE: I am working in RPGLE. If you are working in C or some other language, you will have to translate some of what I say into your own terms.
The array returned in the buffer pointed to by the buffer_ptr parameter that you give to the API is an array of users with authorities to the object. You can create a User Space object (auto-extending) to hold the information, and give the API the address of the start of the space -- that way you can 'slide' a structure over the User Space by applying offsets to the start address.
Now when the API is executed, it fills the User Space whose address you passed in Buffer_ptr. Read the first 64 bytes into your Qp0l_Authority_General_t structure. The array of users starts at the User Space address plus the offset specified.
Now, for each user in turn, base a structure on the User Space address + offset + (48 * (user entry number - 1))The structure will be Qp0l_Authority_Users_t as described in the API documentation. Now you can just read the fields in the structure. Here's the the source for a set of User Space procedures we use that can help, and which include list handling of the sort that is involved here.
For the second question, you need to use a list API or QShell command to list the objects in the IFS directories you want to examine. Read that list, and for each object you are interested in call your authority reporting routine. Note that once the User Space has been created, it can be reused just by passing its start address to each call of the API.
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
Dig Deeper on RPG iSeries programming
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ... Continue Reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ... Continue Reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record... Continue Reading