COMPILE ROUTINE FIX_RUN_STAGE_WFR(Dummy)
ROWDEF(CHARSTR)


DECLARE SUBROUTINE Send_Dyn

$INSERT RUN_STAGE_EQUATES
$INSERT RUN_STAGE_WFR_EQUATES


OPEN 'RUN_STAGE' TO StageTable ELSE
	DEBUG
END


OPEN 'RUN_STAGE_WFR' TO StageWfrTable ELSE
	DEBUG
END
*
GOTO Bail ;**********************  Sanitized for you Protection  *************************




SELECT StageWfrTable


DEBUG


Done = 0

LOOP
	READNEXT StageWfrKey ELSE Done = 1
UNTIL Done
	Stage = FIELD(StageWfrKey,'*',2)
	
	READ StageWfrRec FROM StageWfrTable,StageWfrKey THEN
	
		WriteFlag = 0
		
		CompDTMs = StageWfrRec<RUN_STAGE_WFR_SIA_COMP_DTM$>
		
		IF INDEX(CompDTMs,'/',1) THEN
			StageWfrRec<RUN_STAGE_WFR_SIA_COMP_DTM$> = ICONV(CompDTMs,'DT')
		
		
			*WRITE StageWfrRec ON StageWfrTable,StageWfrKey THEN
				Send_Dyn(StageWfrKey:' / ':StageWfrRec<RUN_STAGE_WFR_SIA_COMP_DTM$>)
			*END
		END ELSE
			UNLOCK StageWfrRec,StageWfrKey ELSE NULL
		END
		
	END ;* End of record read
		


REPEAT







GOTO Bail


 * * * * * * * * * * *

SELECT StageTable

Done = 0

DEBUG
LOOP
	READNEXT StageKey ELSE Done = 1
UNTIL Done
	READ StageRec FROM StageTable,StageKey THEN
	
		CompDTM = StageRec<RUN_STAGE_COMP_DTM$>
		
		IF INDEX(CompDTM,'/',1) THEN
			StageRec<RUN_STAGE_COMP_DTM$> = ICONV(CompDTM,'DT')
			
			WRITE StageRec ON StageTable,StageKey THEN
				Send_Dyn(StageKEy)
			END
		END
		
		
	END

REPEAT



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


END
