COMPILE ROUTINE LOAD_REACT_MAINT(Dummy)
ROWDEF (CHARSTR)

DECLARE SUBROUTINE SEND_INFO, SEND_DYN, Utility, msg, obj_React_Event, obj_React_Maint

DECLARE FUNCTION obj_React_Maint

$INSERT REACT_UTIL_EQU
$INSERT REACT_EVENT_EQUATES
$INSERT REACTOR_LOG_EQU
$INSERT REACT_ESC_EQUATES
$INSERT REACT_MAINT_EQUATES



EQU COL$PROB_CAT	TO 1
EQU COL$SERV_IDS	TO 2
EQU COL$TUBE_ID		TO 3
EQU COL$GR_NOS		TO 4

EQU CRLF$ TO \0D0A\

OPEN 'REACTOR_LOG' TO ReactLogTable ELSE
	DEBUG
	GOTO Bail
END

OPEN 'REACT_MAINT' TO ReactMaintTable ELSE
	DEBUG
	GOTO Bail
END

SELECT ReactLogTable



LoadCnt = 0
Done = 0
LOOP
	READNEXT ReactLogKey ELSE Done = 1
UNTIL Done OR LoadCnt > 2500
	READ ReactLogRec FROM ReactLogTable,ReactLogKey THEN
		
		LoadCnt += 1
		CodeData = obj_React_Maint('Convert',ReactLogKey:@RM:ReactLogRec)
		
		OpenDTM = OCONV(ReactLogRec<REACTOR_LOG_START_DATE$>,'D4/'):' ':OCONV(ReactLogRec<REACTOR_LOG_START_TIME$>,'MTS')
		CompDTM	= OCONV(ReactLogRec<REACTOR_LOG_END_DATE$>,'D4/'):' ':OCONV(ReactLogRec<REACTOR_LOG_END_TIME$>,'MTS')
		
		IF CodeData NE '' THEN
			
			RMRec = ''
			RMRec<REACT_MAINT_RL_ID$>				= ReactLogKey
			RMRec<REACT_MAINT_REACT_NO$>			= ReactLogRec<REACTOR_LOG_REACTOR$>
			RMRec<REACT_MAINT_REACT_PROB_CAT_ID$>	= CodeData<COL$PROB_CAT>
			RMRec<REACT_MAINT_REACT_SERV_ID$>		= CodeData<COL$SERV_IDS>
			RMRec<REACT_MAINT_OPEN_BY$>				= ReactLogRec<REACTOR_LOG_ENTRY_ID$>
			RMRec<REACT_MAINT_OPEN_DTM$>			= ICONV(OpenDTM,'DT')
			RMRec<REACT_MAINT_COMP_BY$>				= ReactLogRec<REACTOR_LOG_TECH_SIG$>
			RMRec<REACT_MAINT_COMP_DTM$>			= ICONV(CompDTM,'DT')
			RMRec<REACT_MAINT_INST_TUBE_ID$>		= CodeData<COL$TUBE_ID>
			RMRec<REACT_MAINT_INST_GR_NO$>			= CodeData<COL$GR_NOS>
			
			WRITE RMRec ON ReactMaintTable,ReactLogKey THEN
				LoadCnt += 1
				Send_Dyn(LoadCnt)
			END
	
			
		END
	
		
		
	END
	
REPEAT




*UNLOCK All

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

END
