COMPILE ROUTINE DUMP_CONFIG(Dummy)
ROWDEF(CHARSTR)

DECLARE SUBROUTINE obj_Schedule,Send_Dyn,Send_Info, Send_Dyn, obj_WO_Step, Set_Status, Btree.Extract, obj_RDS, RList, ErrMsg, obj_Tables
DECLARE FUNCTION Get_Status, Set_Printer, obj_RDS, ErrMsg

$INSERT RDS_EQU
$INSERT WO_LOG_EQU
$INSERT ORDER_EQU
$INSERT PROD_SPEC_EQU
$INSERT WO_DAILY_SCHED_EQU
$INSERT WO_MASTER_SCHED_EQU
$INSERT SCHED_DET_EQUATES

EQU WFS$ TO \7C5E\

MastSched = XLATE('CONFIG','WO_MAST_SCHED','','X')

Dates		= MastSched<Dates$>
Month		= MastSched<Month$>
MaxReact	= MastSched<MaxReacts$>

SchedDts = ''

IF @USERNAME = 'BRYCE_BARB' THEN DEBUG

FOR SchedDay = 1 TO 31
	SchedDt 				= ICONV(FIELD(Dates<1,SchedDay>,' ',2,6),'D')
	SchedDts<1,SchedDay>	= SchedDt
	
	AllReactsDay = MastSched<SchedDay+3>
	
	FOR ReactNo = 20 TO MaxReact
		SchedData = MastSched<SchedDay+3,ReactNo>
		
		*Send_Dyn(ReactNo:' ':OCONV(SchedDts<1,SchedDay>,'D4'):' SchedData: ':SchedData)
		
		CONVERT ';' TO @FM IN SchedData
		SWAP 'Open' WITH '' IN SchedData
		SWAP WFS$ WITH @VM IN SchedData
		
		scCnt = COUNT(SchedData,@FM) + (SchedData NE '')
		
		SchedSeq = 0
		FOR N = 1 TO scCnt
		
			WONo = ''
			Comment = ''
			
			WODat = SchedData<N,1>
			Trailer = SchedData<N,2>
			
			WONo = WODat[1,' ']
			IF LEN(WONo) > 6 THEN
				WONo = WONo[1,6]
				WOStep = WONo[8,1]
			END ELSE
				WOStep = ''
			END
			
			
			IF WONo NE '' OR Trailer NE '' THEN
				SchedSeq += 1
				Send_Dyn(ReactNo:' ':OCONV(SchedDts<1,SchedDay>,'D4'):' SchedSeq: ':SchedSeq:' ':WONo:' - ':Trailer)
				
				SchedDetKey = ReactNo:'*':SchedDt:'*':SchedSeq
				SchedDetRec =''
				SchedDetRec<SCHED_DET_WO_NO$>	= WONo
				SchedDetRec<SCHED_DET_DESC$>	= Trailer
				SchedDetRec<SCHED_DET_WO_STEP$>	= WOStep
				
				otParms = 'SCHED_DET':@RM:SchedDetKey:@RM:@RM:SchedDetRec
				obj_Tables('WriteRec',otParms)
				
				IF Get_Status(errCode) THEN DEBUG
				
			END
			
			
		
		NEXT N
		
		
	
	NEXT ReactNo

NEXT SchedDay





GOTO Bail

FOR I = 20 TO 68
	
	SchedRec = XLATE('CONFIG','WO_DAILY_SCHED':I,'','X')
	
	IF SchedRec NE '' THEN
		Send_Dyn(' ')
		Send_Dyn(CHAR(09):'Reactor: ':SchedRec<Reactor$>)
		Send_Dyn(CHAR(09):'WOCust: ':SchedRec<WOCust$>)
		Send_Dyn(CHAR(09):'BoxInfo: ':SchedRec<BoxInfo$>)
		Send_Dyn(CHAR(09):'Size: ':SchedRec<Size$>)
		Send_Dyn(CHAR(09):'ReactorType: ':SchedRec<ReactorType$>)
	END
	
	Send_Dyn('----')
	
	
	
NEXT I




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

END
