Ensuring that UCBs are not deleted

In a dynamic configuration environment, any program that obtains a UCB address must ensure that the UCB will not be deleted before the program has finished referencing the UCB. Pinning prevents a device's UCB and other related data structures from being deleted. Pinning a UCB ensures that the returned address for that UCB is valid as of the moment the system returned the address. It also ensures that the address remains valid as long as the UCB is pinned. You can pin a UCB by specifying the PIN parameter on the UCBLOOK macro, the UCBPIN macro, or the UCBSCAN ADDRESS macro. When the PIN parameter is specified on any of these macros, the system returns a pin token. The pin token identifies the pin, and will be required for unpinning the UCB.

Programs that pin a UCB are also responsible for unpinning it once the UCB is no longer being used. Unpinning allows a device's UCB and other related data structures to be deleted. Unpinning is done through the UCBPIN macro.

For a description of the circumstances under which pinning is not required, see When pinning is not required.