!
      subroutine putms(diskfile,msspath)
!
! Dispose local diskfile to mass store path msspath.
! This uses dcs fortran callable msrcp.
!
! Args:
      character(len=*),intent(in) :: diskfile,msspath
!
! Local:
      logical :: exists
      integer :: ier
!     character(len=1024) :: dcs_output
      character(len=520) :: opts
!
! External:
      integer,external :: my_msrcp
!
! This routine executed only if -DMSS was set in makefile, indicating
! machine has access to mss via fortran callable dcs routine msrcp().
!
#if (MSS == 0)
      write(6,"(/,'>>> putms: Machine running this code does not have ',
     |  'access to mss mass store.')")
      write(6,"('If this is in error (machine does have access ',
     |  'to mss, i.e., fortran callable msrcp), recompile with -DMSS')")
      write(6,"('File ',a,' was NOT disposed to mss',/)") trim(diskfile)
      return
#endif
!
! Both arguments must be defined:
      if (len_trim(diskfile)==0) then
        write(6,"(/,'>>> putms: Diskfile input is blank.')")
        write(6,"(11x,'Diskfile NOT disposed to mss.')")
        return
      endif
      if (len_trim(msspath)==0) then
        write(6,"(/,'Note putms: Msspath input is blank.')")
        write(6,"(11x,'Diskfile ',a,' NOT disposed to mss.')")
     |    trim(diskfile)
        return
      endif
!
! Check for existence of diskfile:
      inquire(file=diskfile,exist=exists)
      if (.not.exists) then
        write(6,"(/,'>>> putms: diskfile ',a,' does not exist.')")
     |    trim(diskfile)
        write(6,"(11x,'Diskfile NOT disposed to mss.')")
        return
      endif
!
! Do the msrcp:
      write(6,"('Disposing disk file ',a,' to mss path ',a)")
     |  trim(diskfile),trim(msspath)
!
! 10/13/06 btf: replace dcs call with my_msrcp (util.F):
!
      opts = '-class reliability=econ'
      ier = my_msrcp(opts,diskfile,"mss:"//trim(msspath))

!#if defined(SUN) || defined(IRIX) || defined(AIX)
!      call msrcp(ier,trim(diskfile)//' mss:'//trim(msspath),
!     |  dcs_output)
!#else
!      call msrcp_(ier,trim(diskfile)//' mss:'//trim(msspath),
!     |  dcs_output)
!#endif

      if (ier /= 0) then
        write(6,"(/,'>>> putms: error from msrcp: ier=',i3)") ier
!       write(6,"('dcs_output=',a)") trim(dcs_output)
        return 
      else
        write(6,"('Successful msrcp of disk file ',a,' to mss path ',
     |    a)") trim(diskfile),trim(msspath)
      endif
      end subroutine putms
