COMPILE ROUTINE LOAD_REACT_STATUS(Dummy)
ROWDEF (CHARSTR)

DECLARE SUBROUTINE SEND_INFO, SEND_DYN, Utility, msg, Btree.Extract, RList

$INSERT REACT_UTIL_EQU

OPEN 'DICT.REACT_UTIL' TO DictVar ELSE
	DEBUG
	GOTO Bail
END

OPEN 'REACT_STATUS' TO FileOut ELSE
	DEBUG
	GOTO Bail
END








FOR Reactor = 20 TO 69
	
	
	CLEARSELECT

	RList('SELECT REACT_UTIL WITH REACTOR = ':QUOTE(Reactor),5,'','','')
	RList('SELECT REACT_UTIL WITH MODE = "P" OR WITH MODE = "U" BY-DSND START_DATE BY-DSND START_TIME',5,'','','')
	
	Done = 0
	LineCnt = 0
	RUKeys = ''

	IF Reactor = 24 THEN DEBUG
	LOOP
		READNEXT RUKey ELSE Done = 1
	UNTIL Done OR LineCnt > 50
		LineCnt += 1
		RURec = XLATE('REACT_UTIL',RUKey,'','X')
		IF RURec<REACT_UTIL_END_DATE$> NE '' THEN
			StopDate = RURec<REACT_UTIL_END_DATE$>
			StopTime = RURec<REACT_UTIL_END_TIME$>
			
			StopDTM = OCONV(StopDate,'D4/'):' ':OCONV(StopTime,'MTS')
			RSRec	= ICONV(StopDTM,'DT')
			*WRITE RSRec ON FileOut,Reactor THEN
				Send_Dyn(Reactor:' ':StopDTM)
			*END
			
			Done = 1
		END
			
	REPEAT
		
	
NEXT REACTOR

/*
ThirtyDaysAgo = OCONV((Date() - 30),'D4/')

SelectSent = 'SELECT REACT_UTIL WITH REACTOR = ':QUOTE(ReactNo):' AND WITH END_DATE GE ':QUOTE(ThirtyDaysAgo):' AND WITH MODE = "P" BY-DSND END_DATE BY-DSND END_TIME'

Set_Status(0)
RList(SelectSent, TARGET_ACTIVELIST$, '', '', '')
IF Get_Status(errCode) THEN
	ErrMsg(errCode)
	RETURN
END

OutOfProdDTM = ''

OPEN 'REACT_UTIL' TO ReactUtilTable THEN
	Done = 0
	LOOP
		READNEXT ReactUtilKey ELSE Done = 1
	UNTIL Done OR OutOfProdDTM NE ''
		READ ReactUtilRec FROM ReactUtilTable,ReactUtilKey THEN
			EndDt = ReactUtilRec<REACT_UTIL_END_DATE$>
			EndTm = ReactUtilRec<REACT_UTIL_END_TIME$>
			OutOfProdDTM = OCONV(EndDt,'D4/'):' ':OCONV(EndTm,'MTS')
		END
	
	REPEAT
END
*/





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

END
