      program mselect
      USE DFLIB
      character*80 line
      character*6  ziffer
      character*60 fname
      character argv*60
      dimension num(1000),n1(1000),n2(1000)
      integer*2 na
c     ziffer is the key of 6 characters: ex. ap00k2 or am10k2
      na=1
      call getarg(na,argv)
      read(argv,'(a6)') ziffer
      na=2
      call getarg(na,argv)
      read(argv,'(i4)') ksel
      na=3
      call getarg(na,argv)
      read(argv,'(a60)') fname
      open (unit=2,file=ziffer//'.lst')
      rewind 2
      kn=0
      do k=1,1000
      read(2,22,end=98) num(k),n1(k),n2(k)
      kn=kn+1
   22 format(3x,i4,2x,2i6)
      end do
   98 knum=kn
      open (unit=3,file=ziffer//'.dat')
      rewind 3
      open (unit=4,file=fname)
      do 1000 i=1,n1(ksel)-1
      read(3,'(a80)') line
 1000 continue
      do 1200 i=n1(ksel),n2(ksel)
      read(3,'(a80)') line
      write(4,'(a80)') line
 1200 continue
      close(2) 
      close(3)
      close(4)
      stop
      end
