C$$$   SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM:    M_MKI4TM     CONVERTS YYDDDHHMM FILES TO I4 TIME
C   PRGMMR:  MILLER, P.       ORG: ERL/PROFS    DATE: 89-08-07
C
C ABSTRACT: THIS ROUTINE CONVERTS A STANDARD PROFS FILE NAME, I.E.
C   YYDDDHHMM, INTO THE CORRESPONDING I4 TIME
C
C PROGRAM HISTORY LOG:
C   81-11-12  FAULKNER,  ORIGINAL VERSION
C   82-09-13  HOAGENSON, CHANGED NAME FROM I4TME_FNAME_G
C   88-10-04  MILLER,    CONVERTED TO STANDARD FORTRAN
C   99-09-15  M. BARTH   COPIED FROM MSAS AND MODIFIED FOR MADIS.
C   08-06-13  L. BENJAMIN CHANGED "MADISCON" INCLUDE TO 
C                         "INTQC1CON1".  
C
C USAGE:    CALL M_MKI4TM(FILENAME, I4TIME, ISTATUS)
C   INPUT ARGUMENT LIST:
C     FILENAME   - PROFS STYLE FILE NAME IN 'YYDDDHHMM' - CHARACTER
C
C   OUTPUT ARGUMENT LIST:
C     I4TIME   - THE CORRESPONDING I4 TIME OF THE FILE NAME - INTEGER
C     ISTATUS   - RETURNED PROGRAM STATUS - INTEGER
C
C REMARKS: NONE
C
C ATTRIBUTES:
C   LANGUAGE: FORTRAN + EXTENSIONS
C   MACHINE: NAS 9000, VAX, UNIX
C
C$$$
      SUBROUTINE M_MKI4TM (FILENAME, I4TIME, ISTATUS)

C
C       This routine converts a standard PROFS file name, i.e. yydddhhm
C,
C       into the corresponding I4 time.
C
C       ON INPUT
C          FILENAME - The PROFS style file name.
C
C       ON OUTPUT
C          I4TIME - The corresponding I4 time of the file name.
C          ISTATUS -  The return status.
C
C       Faulkner, W.    12-NOV-1981     Original Version
C       HOAGENSON       13-SEP-1982     Changed name from I4TME_FNAME_G
C       Miller, P.      04-Oct-1988     Converted to standard FORTRAN

      INCLUDE 'IMPLICIT'
      INCLUDE 'INTQC1CON1'

      CHARACTER*(*) FILENAME
      INTEGER IFILE(9),M_GTI4TM,I4TIME,I,ISTATUS,
     +        NYEAR,MONTH,JDAY,NDAY,NHOUR,MIN
      INTEGER ICHAR0
C
C       Check the length of FILENAME to be sure that it is valid.
C
      IF (LEN(FILENAME).NE.9) THEN
         GO TO 1000
      END IF
C
C       Determine representation for '0' in this character set.
C       ASCII Character set '0'=30x=48
C
      ICHAR0=48
C
C       Split the file name into individual integers, checking for
C       invalid characters in the file name.
C
      DO 10 I = 1,9
         IFILE(I) = ICHAR(FILENAME(I:I))-ICHAR0
         IF (IFILE(I) .LT. 0 .OR. IFILE(I) .GT.9) THEN
            GO TO 1000
         END IF
10    CONTINUE
C
C       Convert these numbers in year, julian day, hours, and minutes.
C
      NYEAR = 10*IFILE(1) + IFILE(2)
      JDAY = 100*IFILE(3) + 10*IFILE(4) + IFILE(5)
      NHOUR = 10*IFILE(6) + IFILE(7)
      MIN = 10*IFILE(8) + IFILE(9)
C
C       Convert the julian day into month and day.
C
      CALL M_CVJLMD (JDAY, NYEAR, MONTH, NDAY, ISTATUS)
      IF (ISTATUS.NE.SUCCESS_P)
     1   GO TO 2000
C
C       Convert these integers into I4 time.
C
      I4TIME = M_GTI4TM (NYEAR, MONTH, NDAY, NHOUR, MIN, 0, ISTATUS)
      IF (ISTATUS.NE.SUCCESS_P)
     1   GO TO 2000
C
C       Successful return
C
      ISTATUS = SUCCESS_P
      RETURN
C
C       Error detected in this routine.
C
 1000 CONTINUE
      ISTATUS = INV_TIME_P
      RETURN
C
C       Error detected in called routine
C
 2000 CONTINUE
      ISTATUS = INV_TIME_P
      RETURN
      END
C**---------------------------------------------------------------------
C**REQUIRED STANDARD FSL DISCLAIMER (NOVEMBER 2000)
C**---------------------------------------------------------------------
C**  OPEN SOURCE LICENSE/DISCLAIMER,  FORECAST SYSTEMS LABORATORY
C**  NOAA/OAR/FSL, 325 BROADWAY BOULDER, CO 80305
C**
C**  THIS SOFTWARE IS DISTRIBUTED UNDER THE OPEN SOURCE DEFINITION, 
C**  WHICH MAY BE FOUND AT http://www.opensource.org/osd.html.
C**
C**  IN PARTICULAR, REDISTRIBUTION AND USE IN SOURCE AND BINARY FORMS,
C**  WITH OR WITHOUT MODIFICATION, ARE PERMITTED PROVIDED THAT THE 
C**  FOLLOWING CONDITIONS ARE MET:
C**
C**  - REDISTRIBUTIONS OF SOURCE CODE MUST RETAIN THIS NOTICE, THIS LIST
C**    OF CONDITIONS AND THE FOLLOWING DISCLAIMER.
C**
C**  - REDISTRIBUTIONS IN BINARY FORM MUST PROVIDE ACCESS TO THIS 
C**    NOTICE, THIS LIST OF CONDITIONS AND THE FOLLOWING DISCLAIMER, AND
C**    THE UNDERLYING SOURCE CODE.
C**
C**  - ALL MODIFICATIONS TO THIS SOFTWARE MUST BE CLEARLY DOCUMENTED, 
C**    AND ARE SOLELY THE RESPONSIBILITY OF THE AGENT MAKING THE 
C**    MODIFICATIONS.
C**
C**  - IF SIGNIFICANT MODIFICATIONS OR ENHANCEMENTS ARE MADE TO THIS
C**    SOFTWARE, THE FSL SOFTWARE POLICY MANAGER 
C**    (softwaremgr.fsl@noaa.gov) BE NOTIFIED.
C**
C**  THIS SOFTWARE AND ITS DOCUMENTATION ARE IN THE PUBLIC DOMAIN AND 
C**  ARE FURNISHED "AS IS."  THE AUTHORS, THE UNITED STATES GOVERNMENT,
C**  ITS INSTRUMENTALITIES, OFFICERS, EMPLOYEES, AND AGENTS MAKE NO 
C**  WARRANTY, EXPRESS OR IMPLIED, AS TO THE USEFULNESS OF THE SOFTWARE
C**  AND DOCUMENTATION FOR ANY PURPOSE.  THEY ASSUME NO RESPONSIBILITY 
C**  (1) FOR THE USE OF THE SOFTWARE AND DOCUMENTATION; OR (2) TO 
C**  PROVIDE TECHNICAL SUPPORT TO USERS.
C**---------------------------------------------------------------------
