COMPILE ROUTINE FIX_REACT_SERVS(Dummy)
ROWDEF(CHARSTR)

DECLARE SUBROUTINE obj_Schedule,Send_Dyn,Send_Infom, obj_Order, RList, ErrMsg
DECLARE SUBROUTINE Set_Status, Send_Info
DECLARE FUNCTION Get_Status, Set_Printer

$INSERT REACT_SERVS_EQUATES

EQU TAB$	TO CHAR(9)

OPEN 'REACT_SERVS' TO ReactServTable  ELSE
	DEBUG
	GOTO Bail
END

Actions  = 'Adjusted':@VM
Actions := 'Calibrated':@VM
Actions := 'Changed':@VM
Actions := 'Change':@VM
Actions := 'Checked':@VM
Actions := 'Cleaned':@VM
Actions := 'Complete Checklist':@VM
Actions := 'Completed':@VM
Actions := 'PM':@VM
Actions := 'Rebuilt':@VM
Actions := 'Repaired':@VM
Actions := 'Replaced':@VM
Actions := 'Reset':@VM
Actions := 'Restored':@VM
Actions := 'Tuned':@VM
Actions := 'See Notes-':@VM
Actions := 'Performed':@VM
Actions := 'Raised':@VM
Actions := 'Lowered':@VM
Actions := 'Leveled':@VM
Actions := 'Converted':@VM
Actions := 'Conversion':@VM
Actions := 'Removed':@VM
Actions := 'Tightened':@VM
Actions := 'Homed':@VM
Actions := 'Increase':@VM
Actions := 'Decrease':@VM
Actions := 'Removed':@VM
Actions := 'Balanced'

ActionCnt = COUNT(Actions,@VM) + (Actions NE '')

Objects  = 'MFC':@VM
Objects := 'Gold':@VM
Objects := 'Elevator':@VM
Objects := 'Susceptor':@VM
Objects := 'Gearbox':@VM
Objects := 'Foxboro':@VM
Objects := 'Board':@VM
Objects := 'Arm':@VM
Objects := 'Board':@VM
Objects := 'Actuator':@VM
Objects := 'Monitor':@VM
Objects := 'Baratron':@VM
Objects := 'Wand':@VM
Objects := 'Bubbler':@VM
Objects := 'Checklist':@VM
Objects := 'Compumotor':@VM
Objects := 'Cylinder':@VM
Objects := 'Gauge':@VM
Objects := 'Valve':@VM
Objects := 'Switch':@VM
Objects := 'Filter':@VM
Objects := 'Lamp':@VM
Objects := 'Shaft':@VM
Objects := 'Spider':@VM
Objects := 'Tube':@VM
Objects := 'Regulator':@VM
Objects := 'OCAP':@VM
Objects := 'Pneumatic':@VM
Objects := 'Sensor':@VM
Objects := 'Controller':@VM
Objects := 'Pump':@VM
Objects := 'System':@VM
Objects := 'Pedestal':@VM
Objects := 'Pressure':@VM
Objects := 'Blower':@VM
Objects := 'Thermocouple':@VM
Objects := 'Fuse':@VM
Objects := 'Skirt':@VM
Objects := 'Injector':@VM
Objects := 'Graphite'


objCnt = COUNT(Objects,@VM) + (Objects NE '')


Systems  = 'N2':@VM
Systems := 'P Type':@VM
Systems := 'N Type':@VM
Systems := 'TCS':@VM
Systems := 'DCS':@VM
Systems := 'RP':@VM
Systems := 'HCl':@VM
Systems := 'H2':@VM
Systems := 'Power':@VM
Systems := 'Water':@VM
Systems := 'PM'

sysCnt = COUNT(Systems,@VM) + (Systems NE '')



SELECT ReactServTable

RecCnt = 0
Done = 0
LOOP
	READNEXT ReactServNo ELSE Done = 1
UNTIL Done
	
	READ ReactServRec FROM ReactServTable,ReactServNo THEN
	
		Description = ReactServRec<REACT_SERVS_DESCRIPTION$>
		Desc = Description
		
		Item = ''
		FOR I = 1 TO ActionCnt
			Action = Actions<1,I>
			IF INDEX(Description,Action,1) THEN
			
				SWAP Action WITH '' IN Description
				Item = TRIM(Description)
			END
		
		UNTIL Item NE ''
		
		NEXT I
		
		IF Action = 'Change' 				THEN Action = 'Changed'
		IF Action = 'See Notes-' 			THEN Action = 'See_Notes'
		IF Action = 'Completed Checklist'	THEN Action = 'Comp_Checklist'
		IF Action = 'Conversion'			THEN Action = 'Converted'
		IF Action = 'Increase'				THEN Action = 'Increased'
		IF Action = 'Decrease'				THEN Action = 'Decreased'
		
		IF Item = '' THEN
			Action	= ''
			Item	= Description
		END
		
		RawItem = Item
		Item = ''
		FOR N = 1 TO objCnt
			Object = Objects<1,N>
	
			IF INDEX(RawItem,Object,1) THEN
				SWAP Object WITH '' IN RawItem
				Item = TRIM(RawItem)
			END
		UNTIL Item NE ''
		
		NEXT N
		
		IF Item = '' THEN
			Object 	= ''
			Item	= RawItem
		END
		
		IF Object = 'Gold'				THEN Object = 'Reflector'
		
		
		RawItem = Item
		Item = ''
		FOR M = 1 TO sysCnt
			System = Systems<1,M>
			
			IF INDEX(RawItem,System,1) THEN
				SWAP System WITH '' IN RawItem
				Item = TRIM(RawItem)
			END
		UNTIL Item NE ''
	
		NEXT M
		
		IF Item = '' THEN
			System = ''
			Item = RawItem
		END
		
		
		ReactServRec<REACT_SERVS_REACT_SYSTEM$>	= System
		ReactServRec<REACT_SERVS_REACT_ITEM$> 	= Object
		ReactServRec<REACT_SERVS_ACTION$>		= Action
		ReactServRec<REACT_SERVS_SVC_DESC$>			= Item
		
		
		
		WRITE ReactServRec ON ReactServTable,ReactServNo THEN
			Send_Dyn(ReactServNo:TAB$:TAB$:Desc:TAB$:TAB$:Action:TAB$:TAB$:Object:TAB$:TAB$:Item)
		END
	END
	
REPEAT

GOTO Bail



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



END
