COMPILE ROUTINE TEST_OBJ_RDS_Audit(Dummy)
ROWDEF(CHARSTR)

DECLARE SUBROUTINE Set_Status, obj_RDS_Audit, Send_Dyn, RList, Send_Info, obj_Tables
DECLARE FUNCTION Get_Status, obj_RDS_Audit, obj_Tables

$INSERT RDS_EQU

Set_Status(0)

EQU TARGET_ACTIVELIST$ TO 5


OPEN 'RDS' TO FileIn ELSE
	DEBUG
	GOTO Bail
END

OPEN 'JCH_WORK' TO WorkFile ELSE
	DEBUG
	GOTO Bail
END

SELECT FileIn

RecCnt = 0
Done = 0
LOOP
	READNEXT RDSNo ELSE Done = 1
UNTIL Done 
	Set_Status(0)
	
	rtParms = 'RDS':@RM:RDSNo
	RDSRecord = obj_Tables('ReadRec',rtParms)			;* Lock RDS
	OrgLen = LEN(RDSRecord)
	IF Get_Status(errCode) THEN
		WRITE 'RDS Locked' ON WorkFile,RDSNo ELSE Null
	END ELSE
		RDSRecord<RDS_PRE_EPI_MOD_FIELD$>		= ''
		RDSRecord<RDS_PRE_EPI_MOD_ID$>			= ''
		RDSRecord<RDS_FIRST_WAFER_MOD_FIELD$>	= ''
		RDSRecord<RDS_FIRST_WAFER_MOD_ID$>		= ''
		RDSRecord<RDS_UNLOAD_MOD_FIELD$>		= ''
		RDSRecord<RDS_UNLOAD_MOD_ID$>			= ''
		RDSRecord<RDS_POST_EPI_MOD_FIELD$>		= ''
		RDSRecord<RDS_POST_EPI_MOD_ID$>			= ''
	END
	
	NewLen = LEN(RDSRecord)
	
	Delta = OrgLen - NewLen
	IF Delta > 0 THEN
		rtParms = FIELDSTORE(rtParms,@RM,4,0,RDSRecord)
		obj_Tables('WriteRec',rtParms)
	END ELSE
		obj_Tables('UnlockRec',rtParms)
	END
	RecCnt += 1
	
	
	Send_Info(RecCnt:' ':RDSNo:' Delta: ':OrgLen - NewLen)
REPEAT



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

RETURN
