Example: Pinning an unallocated and offline device

A program receives a device number for a DASD as input. The program is to format the specified device, and needs to ensure that the device cannot be deleted while it is being formatted. To accomplish these things the program must do the following:
  • Pin the device by issuing the UCBLOOK macro with the PIN parameter, specifying the device number as input. UCBLOOK pins the UCB, and returns the UCB address and a pin token to the program.
  • Format the DASD.
  • Unpin the UCB through the UCBPIN macro with the UNPIN option, using the pin token returned when the UCB was pinned.