* PACKAGE YSUN   
*
*"  [HIS] 90/05/19(numaguti)
*"        92/06/05(takepiro)
*"        97/09/23(horinout) NFILN=38->100
*
*********************************************************************
      SUBROUTINE ERRTRA 
*
*   [INTERNAL WORK] 
      INTEGER    IPID, IRET
*
*   [INTRINSIC FUNC] 
      INTEGER    GETPID
      INTEGER    KILL
*      
      IPID=GETPID()
      IRET=KILL(IPID,5)
*
      RETURN
      END
*********************************************************************
      SUBROUTINE YCLOCP        
     I         ( HREM   )
*
*   [INPUT] 
      CHARACTER  HREM*(*)                    
*
*   [INTERNAL SAVE]  
      ReaL*8       CPUOLD                      
      ReaL*8       VPUOLD                      
      DATA       CPUOLD, VPUOLD / 0.  , 0.   /
      SAVE
*
*   [INTERNAL WORK] 
      ReaL*8       CPUTIM                      
      ReaL*8       VPUTIM                      
*
      CALL YCLOCK( CPUTIM, VPUTIM )
      WRITE ( 6,9000 ) HREM, CPUTIM - CPUOLD, VPUTIM - VPUOLD,
     &                       CPUTIM         , VPUTIM
 9000 FORMAT( ' ',A8,': CPU/VPU TIME = ', 2E10.5, ' : ', 2E10.5 )
      CPUOLD = CPUTIM
      VPUOLD = VPUTIM
*
      RETURN
      END
********************************************************************
      SUBROUTINE YCLOCK           
     O         ( CPUTIM, VPUTIM )
*
*   [OUTPUT] 
      ReaL*8       CPUTIM                      
      ReaL*8       VPUTIM                      
*
*   [INTERNAL SAVE] 
      ReaL*8       TICKS
      ReaL*8       TICK0, TUSR0                
      DATA       TICK0, TUSR0 / 0.  , 0.    /
      SAVE
*
*   [INTERNAL WORK] 
      ReaL*4       TARRAY( 2 )       
*
*   [INTRINSIC FUNC] 
      ReaL*4       ETIME             
*
      TICKS  = ETIME( TARRAY )
      CPUTIM = TICKS - TICK0
      VPUTIM = TARRAY( 1 ) - TUSR0
*
      RETURN
*======================================================================
      ENTRY      YCLOCL        
*
      TICK0 = ETIME( TARRAY )
      TUSR0 = TARRAY( 1 )
*
      RETURN
      END
***********************************************************************
      SUBROUTINE MKFILN      
     M         ( HFILE ,
     I           HCH   , HREP    )
*
*   [MODIFY] 
      CHARACTER  HFILE  *(*)
*
*   [INPUT] 
      CHARACTER  HCH    *1
      CHARACTER  HREP   *(*)
*
*   [INTERNAL WORK] 
      INTEGER    NFILN
      PARAMETER (NFILN=100)
      CHARACTER  HFILX  *(NFILN)
      INTEGER    NFILE, NREP, I, II
*
*   [EXTERNAL FUNC] 
      INTEGER    LENC
*
      HFILX = HFILE
      HFILE = ' '
      NREP  = LENC( HREP  )
      NFILE = LEN ( HFILE )
      II    = 1
*
      DO 1100 I = 1, MIN( NFILE, NFILN )
         IF ( II .GT. NFILE ) GOTO 1200
         IF      ( HFILX(I:I) .EQ. HCH ) THEN
            HFILE(II:II+NREP-1) = HREP(1:NREP)
            II = II + NREP
         ELSE
            HFILE(II:II) = HFILX(I:I)
            II = II + 1
         ENDIF
 1100 CONTINUE
 1200 CONTINUE
*
      RETURN
      END
***********************************************************************
      SUBROUTINE REWNML         
     O         ( IFILE, JFILE )
*
*   [OUTPUT] 
      INTEGER    IFILE
      INTEGER    JFILE
*
*   [INTERNAL SAVE] 
      INTEGER    IFILEZ, JFILEZ
      DATA       IFILEZ / 5 /
      DATA       JFILEZ / 6 /
      SAVE
*
      REWIND ( IFILEZ, ERR = 1999 )
      IFILE = IFILEZ
      JFILE = JFILEZ
      RETURN
*
 1999 IF ( IFILEZ .EQ. 5 ) THEN
         CALL MSGDMP( 'W','REWNML','UNIT 5 MAY BE A STANDARD INPUT' )
         IFILE = IFILEZ
         JFILE = JFILEZ
      ELSE
         CALL MSGDMP( 'E','REWNML','ERROR IN REWINDING' )
*        STOP
      ENDIF
*
      RETURN
*======================================================================
      ENTRY      SETNML          
     I         ( IFILE, JFILE )
*
      IFILEZ = IFILE
      JFILEZ = JFILE
*
      RETURN
      END
***********************************************************************
      SUBROUTINE YPREP      
*
      RETURN
      END
***********************************************************************
      SUBROUTINE YFINE      
*
      RETURN
      END
***********************************************************************
      INTEGER FUNCTION IOSLEV      
     I               ( IOS   )
*
*   [INPUT] 
      INTEGER    IOS
*
      IF ( IOS.EQ.0 ) THEN
         IOSLEV = 0
      ELSE
         IOSLEV = 2
      ENDIF
*
      RETURN
      END
***********************************************************************
      SUBROUTINE YDATE    
     O         ( HDATE )
*
*   [OUTPUT] 
      CHARACTER  HDATE  *(*)             
*
*   [INTERNAL WORK] 
      INTEGER    IDATE1 ( 3 )            
*
      CALL  IDATE ( IDATE1 )
      IF ( IDATE1(1) .LT. 100 ) IDATE1(1) = IDATE1(1) + 1900

      HDATE = '****/0*/0*'
      WRITE ( HDATE(1:4) , '(I4)'   ) IDATE1(1)
      WRITE ( HDATE(6:7) , '(I2.2)' ) IDATE1(2)
      WRITE ( HDATE(9:10), '(I2.2)' ) IDATE1(3)
*
      RETURN
      END
***********************************************************************
      SUBROUTINE YTIME  
     O         ( HTIME )
*
*   [OUTPUT] 
      CHARACTER  HTIME  *(*)             
*
*   [INTERNAL WORK] 
      INTEGER    ITIME1 ( 3 )            
*
      CALL  ITIME ( ITIME1 )

      HTIME = '0*:0*:0*'
      WRITE ( HTIME(1:2), '(I2.2)' ) ITIME1(1)
      WRITE ( HTIME(4:5), '(I2.2)' ) ITIME1(2)
      WRITE ( HTIME(7:8), '(I2.2)' ) ITIME1(3)
*
      RETURN
      END
