cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c      program flspecs

      character*8 id,id1
      real post1(8), post(8)
      parameter (dval=0.1701412E+39)

      call getfile2(21,' Infile ','in','unformatted','.pos')
      call getfile2(22,' Outfile for fl specs ','out',
     &   'formatted','.fls')

      print '(/a$)', ' Give post option of interest [1 to 6]: '
      read *, n
      n=n+2

      write(22,999) n-2
 999  format(1x,'AVERAGE VALUE FOR POST OPTION= ',i4,/)
      write(22,1000)
 1000 format(3x,'ID',8x,'NPTS',8x,'AVE',9x,'MAX',9x,'MIN',7x,
     &  'MAXGRAD',5x,'MINGRAD',/)

      call getpost (21, id1, post1, *90)
  5   icount=1
      vmax=post1(n)
      vmin=post1(n)
      sum=post1(n)
      gmax=-dval
      gmin=+dval
      postlast=post1(n)

 10   call getpost (21, id, post, *50)
      if(id(1:6).ne.id1(1:6)) go to 50
      icount=icount+1
      vmax=amax1(vmax,post(n))
      vmin=amin1(vmin,post(n))
      sum=sum+post(n)
      gmax=amax1(gmax,abs(post(n)-postlast))
      gmin=amin1(gmin,abs(post(n)-postlast))
      postlast=post(n)
      go to 10

 50   vave=sum/icount
      if(icount.eq.1) then
        gmax=0.0
        gmin=0.0
      endif
      write(22,1001) id1(1:6),icount,vave,vmax,vmin,gmax,gmin
 1001 format(a8,i10,5f12.2)
      if(id(1:6).ne.id1(1:6)) then
        id1=id
        do 60 i=1,8
 60     post1(i)=post(i)
        go to 5
      endif

 90   close(21)
      close(22)

      stop ' '
      end



 60     post1(i)=post(i)
        go to 5
      endif

 90   close(21)
      close(22)

      stop ' '
     
