COMPILE ROUTINE FIX_mess(Dummy)
ROWDEF(CHARSTR)

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

$INSERT RDS_EQU
$INSERT WO_LOG_EQU
$INSERT WO_MAT_EQUATES
$INSERT ORDER_EQU
$INSERT PROD_SPEC_EQU
$INSERT SURFACE_SCAN_EQUATES

EQU TARGET_ACTIVELIST$ TO 5

EQU CRLF$ TO \0D0A\

OPEN 'RDS' TO RDSTable ELSE
	debug
	GOTO Bail
END

OPEN 'WO_MAT' TO WOMatTable ELSE
	debug
	GOTO Bail
END

DEBUG

WONos = '138245':@FM:'138229':@FM:'138228':@FM:'138240'

FOR I = 1 TO 4
	WONo = WONos<I>
		
	SelectSent = 'SELECT WO_MAT WITH WO_NO "':WONo:'"'
	
	RList(SelectSent,TARGET_ACTIVELIST$,'','','')

	Done = 0
	LOOP
		READNEXT WOMatKey ELSE Done = 1
	UNTIL Done
		READ WOMatRec FROM WOMatTable,WOMatKey THEN
			OK = 0
			IF WOMatRec<WO_MAT_CUST_PART_NO$> = '800VN' THEN
				WOMatRec<WO_MAT_CUST_PART_NO$> = '126830'
				OrgNum = '800VN'
				NewNum = '126830'
				OK = 1
			END
			
			IF WOMatRec<WO_MAT_CUST_PART_NO$> = '1000VN' THEN
				WOMatRec<WO_MAT_CUST_PART_NO$> = '126852'
				OrgNum = '1000VN'
				NewNum = '126852'
				OK = 1
			END
			
			IF OK = 1 THEN
				WRITE WOMatRec ON WOMatTable,WOMatKey THEN
					Send_Dyn(WOMatKey:' - ':OrgNum:' -> ':NewNum)
				END
			END
		END

	REPEAT
NEXT I


GOTO Bail

* * * * * * *
Skip:
* * * * * * *


SELECT FileIn

Done = 0
RecCnt = 0
LOOP
	READNEXT RDSNo ELSE Done = 1
UNTIL Done 
	RecCnt += 1
	Send_Info(RecCnt)
	
	*IF INDEX(RDSNo,@SVM,1) OR INDEX(RDSNo,@VM,1) OR INDEX(RDSNo,@FM,1) THEN
		READ FungedRec FROM FileIn,RDSNo THEN
			IF FungedRec<14> NE '' THEN
				DEBUG
				*DELETE FileIn,RDSNo THEN
					Send_Dyn(RDSNo)
				*END
			END
		END
	*END
REPEAT


GOTO Bail




RDSNos  = '380294':@VM
RDSNos := '380297':@VM
RDSNos := '380300':@VM
RDSNos := '380303':@VM
RDSNos := '380304':@VM
RDSNos := '380308':@VM
RDSNos := '380309':@VM
RDSNos := '380311':@VM
RDSNos := '380317':@VM
RDSNos := '380331'

RDSCnt = COUNT(RDSNos,@VM) + 1

FOR I = 1 TO RDSCnt
	RDSNo = RDSNos<1,I>
	READ RDSRec FROM FileIn,RDSNo THEN
		IF RDSRec<RDS_PROD_SPEC_ID$> = '3029' THEN
			IF RDSRec<RDS_QUOTE_NO$> = '6035' THEN
				IF RDSRec<RDS_CUST_NO$> = '6593' THEN
					RDSRec<RDS_PROD_SPEC_ID$>	= '3062'
					RDSRec<RDS_QUOTE_NO$>		= '6068'
					RDSRec<RDS_CUST_NO$>		= '7034'
					debug
					DELETE  FileIn,I THEN
						WRITE RDSRec ON FileIn,RDSNo THEN
							Send_Dyn(RDSNo)
						END
					END
				END
			END
		END
	END

NEXT I



GOTO Bail




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

END
