      program jobb
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c  program to run a unix-like job under dos
c  allows input of program and input in a job file
c  e.g.   geogrid <<!   and  #-comments
c  NB: <<! must be last in line
c
c  to run type:  job <filename | runjob
c
c  (c) Rene Forsberg, KMS, Dubai Nov 2001
c  
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
      character*79 c
      character*4 cinp
      logical linp
c
      open(11,file='runjob.bat',status='unknown')
c
c     scan through job file
c
      ninp = 0
      linp = .false.
10    read(*,'(a)',end=80) c
      if (c(1:1).eq.'#') goto 10
      do k=1,77
        if (c(k:k+2).eq.'<<!') then
          linp =.true.
          ninp = ninp+1
          write(cinp,'(i4)') ninp+9000
          open(12,file='wrkr'//cinp//'.tmp',status='unknown')
          write(11,'(a)') c(1:k-1)//'< '//'wrkr'//cinp//'.tmp'
          goto 10
        endif
      enddo
      if (c(1:1).eq.'!') then
        close(12)
        linp = .false.
        goto 10
      endif
      if (linp) then
        write(12,'(a)') c
      else
        write(11,'(a)') c
      endif
      goto 10
c
80    if (linp) stop '*** error in job, no ! termination'
      write(11,*) 'del wrkr*.tmp'
      end       
