C$Procedure EKTMBD ( E-kernel time bounds ) SUBROUTINE EKTMBD ( FILE, MINTIM, MAXTIM, HAVTIM ) C$ Abstract C C Determine the maximum and minimum times in all of the C tables of an E-kernel C C$ Copyright C C Copyright (1997), California Institute of Technology. C U.S. Government sponsorship acknowledged. C C$ Required_Reading C C None. C C$ Keywords C C MAKLABEL C C$ Declarations IMPLICIT NONE INCLUDE 'ekattdsc.inc' INCLUDE 'ektype.inc' CHARACTER*(*) FILE DOUBLE PRECISION MINTIM DOUBLE PRECISION MAXTIM LOGICAL HAVTIM C$ Brief_I/O C C VARIABLE I/O DESCRIPTION C -------- --- -------------------------------------------------- C FILE I The name of an E-kernel C MINTIM O The minimum time of any scalar time column C MAXTIM O The maximum time of any scalar time column C HAVTIM O A logical indicating if any times are present C C$ Detailed_Input C C FILE is a SPICE E-kernel C C$ Detailed_Output C C MINTIM is the minimum time of all time values belonging C to scalar time columns in FILE C C MAXTIM is the maximum time of all time values belonging C to scalar time columns in FILE C C HAVTIM is a logical indicating whether or not any C time values were located among the scalar columns C of FILE. If they were HAVTIM returns the value C TRUE. Otherwise it returns the value FALSE. C If HAVTIM is FALSE both MINTIM and MAXTIM are C meaningless. C C$ Parameters C C None. C C$ Files C C None. C C$ Exceptions C C 1) Inconsistency between the results of various E-kernel calls C are diagnosed as MAKLABEL(BUG). This error should never C be signalled, but the code exists just in case. C C 2) All legitimate errors are diagnosed by routines in the C call tree of this routine. C C$ Particulars C C This is a utility routine that searches the contents of C an E-kernel locating all scalar time columns. It returns C the maximum and minimum values found in any of these C scalar time columns. C C$ Examples C C See MAKLABEL C C$ Restrictions C C None. C C$ Author_and_Institution C C W.L. Taber (JPL) C C$ Literature_References C C None. C C$ Version C C- MAKLABEL Version 1.1.0, 10-JAN-1997 (WLT) C C Balanced CHKIN/CHKOUT calls. C C- MAKLABEL Version 1.0.0, 10-JAN-1997 (WLT) C C C-& C$ Index_Entries C C Return the minimum time in an E-kernel C Return the maximum time in an E-kernel C C-& C C SPICELIB Functions C INTEGER RTRIM LOGICAL RETURN LOGICAL FAILED C C Parameters C INTEGER WDSIZE PARAMETER ( WDSIZE = 64 ) INTEGER QSIZE PARAMETER ( QSIZE = 500 ) C C Local Variables C CHARACTER*(WDSIZE) TABLE CHARACTER*(WDSIZE) COLUMN CHARACTER*(QSIZE) QUERY CHARACTER*(QSIZE) ERRMSG DOUBLE PRECISION TABMIN DOUBLE PRECISION TABMAX INTEGER HANDLE INTEGER NTABS INTEGER NCOLS INTEGER TABNUM INTEGER COLNUM INTEGER NROWS INTEGER NOTES ( ADSCSZ ) LOGICAL BADQRY LOGICAL NLLMIN LOGICAL NLLMAX LOGICAL FNDMIN LOGICAL FNDMAX C C Standard SPICE error handling. C IF ( RETURN() ) THEN RETURN END IF CALL CHKIN ( 'EKTMBD' ) HAVTIM = .FALSE. C C Load the E-kernel C CALL EKLEF ( FILE(1:RTRIM(FILE)), HANDLE ) IF ( FAILED() ) THEN CALL CHKOUT ( 'EKTMBD' ) RETURN END IF C C Find out how many segments are in the E-kernel C CALL EKNTAB ( NTABS ) IF ( FAILED() ) THEN CALL CHKOUT ( 'EKTMBD' ) RETURN END IF C C Examine each table for the existence of TIME columns. C HAVTIM = .FALSE. DO TABNUM = 1, NTABS C C Get the name of next table in the E-kernel and the number C of columns that belong to that table. C CALL EKTNAM ( TABNUM, TABLE ) CALL EKCCNT ( TABLE, NCOLS ) IF ( FAILED() ) THEN CALL CHKOUT ( 'EKTMBD' ) RETURN END IF C C Determine the number columns in this table. C DO COLNUM = 1, NCOLS C C Determine the type of this column C CALL EKCII ( TABLE, COLNUM, COLUMN, NOTES ) IF ( FAILED() ) THEN CALL CHKOUT ( 'EKTMBD' ) RETURN END IF C C We examine this column only if it is a time column and C it is not a vector or variable size column. C IF ( NOTES(ATTTYP) .EQ. TIME . .AND. NOTES(ATTSIZ) .EQ. 1 ) THEN C C We've got a time column. Find out its range of values C from the file. C BADQRY = .FALSE. QUERY = 'SELECT