COMPILE ROUTINE VERIFY_REACT_UTIL()
ROWDEF(CHARSTR)


DECLARE SUBROUTINE Send_Dyn,Send_Info,RList
DECLARE FUNCTION Get_Status

$INSERT REACT_UTIL_EQU

OPEN 'REACT_UTIL' TO FileIn ELSE
	Send_Dyn('Unable to open "REACT_UTIL"')
	GOTO Bail
END

OPEN 'DICT.REACT_UTIL' TO @DICT ELSE
	Send_Dyn('Unable to open DICT.REACT_UTIL')
	GOTO Bail
END

SelectSent = 'SELECT REACT_UTIL WITH START_DATE > "12/31/2003" BY REACTOR BY START_DATE BY START_TIME'

RList(SelectSent,5,'','')

IF Get_Status(errCode) THEN DEBUG

Done = 0
PrevRec = ''
PrevKey = ''
PrevEndDTM = ''
PrevStartDTM = ''
PrevLog = ''
Record = ''
RecCnt = 0
LOOP
	READNEXT @ID ELSE Done = 1
UNTIL Done
	
	
	READ @RECORD FROM FileIn,@ID THEN
		RecCnt += 1
		Send_Info(RecCnt)

		IF @RECORD<REACT_UTIL_REACTOR$> = PrevRec<REACT_UTIL_REACTOR$> THEN
			IF {START_DTM} = PrevEndDTM THEN DateMatch = 1 ELSE DateMatch = 0
			
			
			IF DateMatch ELSE
				ErrMesg = 'Previous: ':PrevKey:' (':Record<11>:')  Current: ':@ID:' (':PrevRec<11>:')'
				Send_Dyn('-----')
				Send_Dyn(PrevKey:' ':OCONV(PrevStartDtm,'DTHS'):' ':OCONV(PrevEndDtm,'DTHS'):' ':PrevLog)
				Send_Dyn(@ID:' ':OCONV({START_DTM},'DTHS'):' ':OCONV({END_DTM},'DTHS'):' ':Record<11>)
			END
		END
		IF Record NE '' THEN
			PrevRec = @RECORD
			PrevStartDTM = {START_DTM}
			PrevEndDTM = {END_DTM}
			PrevLog = {REACTOR_LOG_ID}
			PrevKey = @ID
		END
	END
REPEAT


* * * * * * *
Bail:
* * * * * * *


END


