Example 27: Allocate three data sets using the REUSE operand

Known:

  1. Allocate MY.DATA.SET on volume STOR03:
    alloc file(x) da(my.data.set') reuse shr
  2. Allocate MY.DATA.SET on volume STOR99. The REUSE operand frees the file x allocation for MY.DATA.SET on volume STOR03 and reallocates file x to MY.DATA.SET on volume STOR99.
    alloc file(x) da('my.data.set') reuse shr vol(stor99)
  3. Allocate MY.DATA.SET on volume STOR99:
    alloc file(x) da('my.data.set') reuse shr

This is satisfied by the current allocation which is MY.DATA.SET on volume STOR99.

Note: REUSE does not free file x and then reallocate file x with MY.DATA.SET on volume STOR03 because it is satisfied by an existing allocation.

If you want to allocate MY.DATA.SET on volume STOR03, you can either free file x and then issue the same allocate command or specify volume STOR03 on the allocation.