c
c	restrict.f 1.3 92/07/01 15:25:22
c
c  Copyright 1991 Intel Corporation, Inc.
c  See the "Copyright" file for complete rights and liability information.

      include 'fcube.h'

      integer*4 dsize, errval, iam, vsize, numvols, nunit
      parameter(dsize = 2**10, vsize = 128)
      integer*4 data(dsize), volumes(vsize)

c  Identify self.

      iam = mynode()

c  Node 0 does all the work ...

      if(iam .eq. 0) then
         print *,'Starting ...'

c    Initialize.

         nunit = 12

         do 1, i = 1, vsize
            volumes(i) = 0
1        continue

         do 2, i = 1, dsize
            data(i) = i
2        continue

c    Restrict disk header of next open to volume 0.

         errval = restrictvol(-1, 1, volumes)

c    Open file.

         open(unit   = nunit,
     1        file   = '/cfs/mydata',
     2        status = 'old',
     3        form   = 'unformatted')

c    Restrict further allocations to volumes 1 and 4.

         volumes(1) = 1
         volumes(2) = 4

         errval = restrictvol(nunit, 2, volumes)

c    Write to the file.

         call cwrite(nunit, data, dsize*4)

c    Show the volume(s) used.

         numvols = restrictvol(nunit, -1, volumes)

         print *, 'Volumes used:'
         write(*, 100) (volumes(i), i = 1, numvols)
100      format(i)

c    Remove all restrictions.

         errval = restrictvol(nunit, 0, 0)

c    Write to the file.

         call cwrite(nunit, data, dsize*4)

c    Show the volume(s) used.

         numvols = restrictvol(nunit, -1, volumes)

         print *, 'Volumes used:'
         write(*, 100) (volumes(i), i = 1, numvols)

      endif

      end
