c
c	lseek.f 1.4 92/07/01 15:23:39
c
c  Copyright 1991 Intel Corporation, Inc.
c  See the "Copyright" file for complete rights and liability information.
c
c  Creates 1000-byte file and sets file pointer to end-of-file.
c
c  Can run on a multi-node cube, but only node 0 does anything.

      include 'fcube.h'

      integer newpos, newsize

c  Node 0 does all the work.

      if(mynode() .eq. 0) then

         print *,'Starting ...'

c    Open the file /cfs/mydata.

         open(unit = 12, file = '/cfs/mydata', status = 'unknown',
     1        form = 'unformatted')

c    Set file size to 1000 bytes.

         newsize = lsize(12, 1000, 0)

         write(*, 100) newsize
100      format('New file size is:        ', i10)

c    Move read/write pointer to the end of the file.

         newpos = lseek(12, 0, 2)

         write(*, 200) newpos
200      format('New pointer position is: ', i10)

c    Close the file /cfs/mydata.

         close(unit = 12, file = '/cfs/mydata', status = 'keep')

      endif

      end
