COMPILE ROUTINE LOAD_WO_MAT_MU_FLAG(Dummy)
ROWDEF(CHARSTR)

DECLARE SUBROUTINE obj_Schedule,Send_Dyn,Send_Info, obj_WO_Log, Set_Status, obj_WO_Step
DECLARE FUNCTION Get_Status, Set_Printer, obj_WO_Step

$INSERT WO_MAT_EQUATES
$INSERT RDS_EQU



OPEN 'WO_MAT' TO WOMatTable ELSE
	DEBUG 
	GOTO Bail
END

OPEN 'RDS' TO RDSTable ELSE
	DEBUG
	GOTO Bail
END

OPEN 'WM_IN' TO WMITable ELSE
	DEBUG
	GOTO Bail
END

OPEN 'WM_OUT' TO WMOTable ELSE
	DEBUG
	GOTO Bail
END


SELECT RDSTable



RecCnt = 0
FixCnt = 0
Done = 0

LOOP
	READNEXT RDSNo ELSE Done = 1
UNTIL Done 
	READ RDSRec FROM RDSTable,RDSNo THEN
		RecCnt += 1
		
		IF RDSRec<RDS_MAKEUP_BOX$> = 1 OR RDSRec<RDS_HOT_LOT$> = 1 THEN
			
			Send_Info(RecCnt:' ':FixCnt)
			ReactType = XLATE('RDS',RDSNo,'REACTOR_TYPE','X')
			RunOrderNo = XLATE('RDS',RDSNo,'RUN_ORDER_NUM','X')
			IF ReactType NE 'EPP' THEN
			   WONo = RDSRec<6>
			   CassNo = RDSRec<RDS_CASS_NO$>
			   IF CassNo = '' AND RunOrderNo NE '' THEN CassNo = RunOrderNo
			   IF WONo NE '' AND CassNo NE '' THEN
			        WOMatKey = WONo:'*':CassNo
			        IF WOMatKey NE '' THEN
		
						READ WOMatRec FROM WOMatTable,WOMatKey THEN
							
							IF RDSRec<RDS_MAKEUP_BOX$> NE '' THEN
								WOMatRec<WO_MAT_MAKEUP_BOX$> = RDSRec<RDS_MAKEUP_BOX$>
							END
								
							IF RDSRec<RDS_HOT_LOT$> = 1 THEN
								WOMatRec<WO_MAT_HOT_LOT$> = 1
							END
							
						    FixCnt += 1
						    WRITE WOMatRec ON WOMatTable,WOMatKey THEN
						    	Send_Dyn(WOMatKey)
						    	
						    END
							
						END
					END
				END
			END
		END
	END
	Send_Info(RecCnt)
REPEAT
	
	
* * * * * * *
Bail:
* * * * * * *

END
