* PACKAGE GURNTF              " 同じパス名を変更
*
*"  [HIS] 920/09/10(numaguti)
*
***********************************************************************
      SUBROUTINE GURNTF
     M         ( HFNAME ,
     I           HFNREF , HFNCHG  )
*
      CHARACTER  HFNAME *(*)
      CHARACTER  HFNREF *(*)
      CHARACTER  HFNCHG *(*)
*
#ifdef SYS_IBMS
      INCLUDE    (GZSIZE)                    !" NCC, NDC
#else
#include         "gzsize.F"                  !" NCC, NDC
#endif
*
      CHARACTER  HFNEXP *(NFILN)
      CHARACTER  HFREXP *(NFILN)
      CHARACTER  HFCEXP *(NFILN)
      CHARACTER  HMESG  *100
      LOGICAL    OEXIST
*
      HFNEXP = HFNAME
      HFREXP = HFNREF
      HFCEXP = HFNCHG
*
      CALL GUNENV( HFNEXP, '.', .FALSE. )
      CALL GUNENV( HFREXP, '.', .FALSE. )
      CALL GUNENV( HFCEXP, '.', .FALSE. )
*
      IF ( HFNEXP .EQ. HFREXP ) THEN
         INQUIRE ( FILE=HFNEXP, EXIST=OEXIST )
         IF ( OEXIST ) THEN
#ifdef SYS_IBMS
            CALL MSGDMP('E','GURNTF','COLLISION IN FILE NAME.')
            STOP
#else
            NN = LENC(HFNAME)
            NC = LENC(HFNCHG)
            HMESG = 'RENAMED:'//HFNAME(1:NN)//'->'//HFNCHG(1:NC)
            CALL MSGDMP( 'W','GURTNF',HMESG )
            CALL SYSTEM( 'mv -f '//HFNEXP//HFCEXP )
#endif
         ENDIF
         HFNAME = HFNCHG
      ENDIF
*
      RETURN
      END
