COMPILE ROUTINE CLEAN_UP_JUNK(Dummy)
ROWDEF(CHARSTR)

DECLARE SUBROUTINE obj_Schedule,Send_Dyn,Send_Infom, obj_Order, obj_WO_Log, RList, RList, ErrMsg
DECLARE SUBROUTIne obj_WO_Step, Set_Status, Send_Info, Send_Dyn
DECLARE FUNCTION Get_Status, Set_Printer, Popup

$INSERT ORDER_EQU
$INSERT WO_LOG_EQU
$INSERT WO_STEP_EQU
$INSERT SCHEDULE_EQU
$INSERT RDS_EQU
$INSERT RLIST_EQUATES
$INSERT POPUP_EQUATES



DEBUG



OPEN 'JCH_LOG' TO LogTable ELSE
	DEBUG
	RETURN
END


IF Get_Status(errCode) THEN DEBUG

SelectStatement  = 'SELECT JCH_LOG '

errCode = ''
RList(SelectStatement, TARGET_ACTIVELIST$, '','','')

IF Get_Status(errCode) THEN
	ErrMsg(errCode)
	DEBUG
	GOTO Bail
END


Done = 0
LOOP
	READNEXT LogNo ELSE Done = 1
UNTIL Done

	READ LogRec FROM LogTable,LogNo THEN
		
		IF LogRec[1,7] = 'RDS_PRE' THEN
			DELETE LogTable,LogNo THEN
				Send_Dyn(LogNo:' - Deleted')
			END
		END ELSE
		
			*WRITE WORec ON WOLogTable,WONo THEN
				Send_Dyn(LogNo:' ':LogRec)
			*END
		END
	END

REPEAT






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

END
