This module makes the processing of a multi user selection easier by passing the selection as one integer parameter which is the sum of all made selections.
Most people are familiar with this concept when it comes to unix / linux / IFS file permissions. Each permission has its own number.
- 1 - Execute
- 2 - Write
- 4 - Read
Now all, some or no permissions can be put — compressed to — one value. For example:
- 0 - no permissions
- 5 - read and execute permissions
- 7 - all (read, write and execute) permissions
So far so good, but how does this makes life easier?
As far as we have come now in this article it makes life more complicated. But it will get much more easier as we proceed.
Passing multiple selections
The i5/OS API Retrieve Job Information can be used to retrieve the library list of the job. The library list is divided in various sections: System, Product, Current, User. If a procedure should return all or only some parts of the library list then multiple selections may be passed to that procedure. These selections could be coded as constants.
Such a procedure call would look like this:
Much easier to read and understand.
Now that procedure has to know what part of the library list the calling program wants to have retrieved. A data structure with the possible selections is created with an overlay alpha field.
With the procedure evalParm the data structure gets filled with the following call:
Keep in mind that the constants (and parameter for the evalParm procedure) value must be a number of the power of 2 (1, 2, 4, 8, 16, 32, 64, ...).
See the examples section for an example of using the evalParm procedure.