COMPILE ROUTINE FIX_REACT_RUN(Dummy)
ROWDEF(CHARSTR)

DECLARE SUBROUTINE obj_Schedule,Send_Dyn,Send_Info, RLIST, obj_React_Run, Set_Status, obj_Tables, RDS_REACT_RUN, FIX_LH, RList
DECLARE SUBROUTINE Btree.Extract
DECLARE FUNCTION Get_Status, Set_Printer, obj_React_Run, obj_Prod_Spec



$INSERT OIPRINT_EQUATES

$INSERT REACT_RUN_EQUATES
$INSERT CLEAN_INSP_EQUATES
$INSERT RDS_EQU
$INSERT DICT_EQUATES
$INSERT RLIST_EQUATES
$INSERT WO_STEP_EQUATES



OPEN 'REACT_RUN' TO ReactRunTable ELSE GOTO Bail
OPEN 'RDS' TO RDSTable ELSE GOTO Bail
OPEN 'CLEAN_INSP' TO CITable ELSE GOTO Bail

OPEN 'DICT.REACT_RUN' TO DictReactRun ELSE GOTO Bail
OPEN 'DICT.CLEAN_INSP' TO DictCleanInsp ELSE GOTO Bail



DEBUG

SelectSent = 'SELECT REACT_RUN WITH REACTOR_TYPE "GAN"'

RList(SelectSent,TARGET_ACTIVELIST$,'','','')

IF Get_Status(errCode) THEN DEBUG


Done = 0
LOOP
	READNEXT RDSNo ELSE Done = 1
UNTIL Done
	READ RRec FROM ReactRunTable,RDSNo THEN
		
		WriteFlag = 0
		
		slotCnt = COUNT(RRec<REACT_RUN_CARR_SLOT_ID$>,@VM) + (RRec<REACT_RUN_CARR_SLOT_ID$> NE '')
		
		FOR I = 1 TO slotCnt
	
			IF RRec<REACT_RUN_CARR_NCR_NO$,I> NE '' THEN
				
				IF RRec<REACT_RUN_CARR_WFR_ID$,I> = '' AND RRec<REACT_RUN_CARR_PREV_WFR_ID$,I> NE '' THEN
			
					RRec<REACT_RUN_CARR_WFR_ID$,I>			= RRec<REACT_RUN_CARR_PREV_WFR_ID$,I>
					RRec<REACT_RUN_CARR_PREV_WFR_ID$,I>		= ''
					
					Send_Dyn(RDSNo:' SlotID: ':RRec<REACT_RUN_CARR_SLOT_ID$,I>:'  ':RRec<REACT_RUN_CARR_WFR_ID$,I>)
					
					WriteFlag = 1
				END
				
			END
		
		NEXT I
		
		IF WriteFlag = 1 THEN
			WRITE RRec ON ReactRunTable,RDSNo THEN
				Send_Dyn('RDSNo: ':RDSNo: 'Written')
			END	
		END
		
		
	
	END	;* End of RRec Read
REPEAT



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



END
