cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cc  27 May 12  v 1.1a WJS				  cc
cc	Must external SCALE since it is "now" a FORTRAN   cc
cc	intrinsic function				  cc
cc                     Version 1.1                        cc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

      program dashplotter
      parameter (nn=2)
      parameter (huge_line=255)

      character*40 names(nn)
      real vals(nn)
      character*255 nam,tmp
      integer handle

      integer num,flag
      character*20 dashstr
      data dashstr/'-------........'/
      logical logvar(nn)
      data logvar/nn*.false./

      external scale

      num=1
      call getarg(1,nam)
      i=2
      do while(i.le.iargc())
         call getarg(i,tmp)
         if(tmp.eq.'-l')then
            logvar(num)=.true.
            i=i+1
         else if(tmp(1:1).eq.'-')then
            dashstr=tmp
            i=i+1
         else
            names(num)=tmp
            call fixstr(names(num))
            num=num+1
            i=i+1
         endif
      enddo
 10   continue
      num=num-1
      if(num.ne.2)stop 'Dash requires two variables'

      call fixstr(nam)

      handle=1
      ilevel=jdbopen(handle,nam,names,40,num)
      if(ilevel.lt.0)then
         if (ilevel.eq.-999)then
            write(*,*)'Object not found or no permission'
         else
            write(*,*)'Variable not found - ',names(-ilevel)
         endif
         call exit(1)
      endif
      ilevel=min(jdblevel(handle,0),jdblevel(handle,1))

      call scale
      call setdash(dashstr)

 100  continue
      flag=jdbread(handle,vals)
      if (flag.lt.0)then
         call jdbclose(handle)
         call penup
         call endplt
         call exit(0)
      endif
      if (flag.lt.ilevel) call dashup
      do 12 i=1,nn
         if (logvar(i)) then
            if (vals(i).gt.0.0) then 
               vals(i)=log10(vals(i))
            else 
               vals(i)=-9999.99
            endif
         endif
 12   continue
            call dash(vals(1),vals(2))
      goto 100
c/* note- this only prints the first element of an array variable */
      end
