COMPILE Subroutine PURGE_RDS(Void)
* ROWDEF(CHARSTR)

DECLARE SUBROUTINE Send_Info, Send_Dyn, obj_Tables, Set_Status
DECLARE FUNCTION obj_Tables

$INSERT RDS_EQUATES

OPEN 'RDS' TO RdsTable ELSE DEBUG

SELECT RdsTable

Done = 0
RecCnt = 0
ByteTotal = 0

LOOP
	READNEXT RdsNo ELSE Done = 1
UNTIL Done
	Set_Status(0)
	otParms = 'RDS':@RM:RdsNo
	RDSRec = obj_Tables('ReadRec',otParms)	;* Reads and sets lock

	IF Get_Status(errCode) THEN
		Send_Dyn(RdsNo:' - Locked')
	END ELSE
	
	
		OrgSize = LEN(RdsRec)
				
		RdsRec<RDS_RECIPE_NO_ORG$> = ''
		RdsRec<RDS_EPI_TIME_ORG$> = '' 
		RdsRec<RDS_DCS_FLOW_ORG$> = ''
		RdsRec<RDS_EPI_H2_FLOW_ORG$> = ''
		RdsRec<RDS_AUX1_ORG$> = ''
		RdsRec<RDS_DOPANT_FLOW_ORG$> = ''
		RdsRec<RDS_AUX2_ORG$> = ''
		RdsRec<RDS_BAKE_TIME_ORG$> = ''
		RdsRec<RDS_LAYER_INFO$> = ''
		RdsRec<RDS_LSL_PRE_EPI_REJ_ORG$> = ''
		RdsRec<RDS_CUST_PRE_EPI_REJ_ORG$> = ''
		RdsRec<RDS_LSL_POST_EPI_REJ_ORG$> = ''
		RdsRec<RDS_CUST_POST_EPI_REJ_ORG$> = ''
		RdsRec<RDS_THICK_MIN_ORG$> = ''
		RdsRec<RDS_THICK_TARGET_ORG$> = ''
		RdsRec<RDS_THICK_MAX_ORG$> = ''
		RdsRec<RDS_THICK_UNITS_ORG$> = ''
		RdsRec<RDS_RES_MIN_ORG$> = ''
		RdsRec<RDS_RES_TARGET_ORG$> = ''
		RdsRec<RDS_RES_MAX_ORG$> = ''
		RdsRec<RDS_RES_UNITS_ORG$> = ''
		RdsRec<RDS_CON_MIN_ORG$> = ''
		RdsRec<RDS_CON_TARGET_ORG$> = ''
		RdsRec<RDS_CON_MAX_ORG$> = ''
		RdsRec<RDS_CON_UNITS_ORG$> = ''
		RdsRec<RDS_THICK_READ_ORG$> = ''
		RdsRec<RDS_SHEETRHO_READ_ORG$> = ''
		RdsRec<RDS_TTHICK_AVG_ORG$> = ''
		RdsRec<RDS_TRES_AVG_ORG$> = ''
		RdsRec<RDS_TTHICK_STDEV_ORG$> = ''
		RdsRec<RDS_TTHICK_MAX_ORG$> = ''
		RdsRec<RDS_TRES_MAX_ORG$> = ''
		RdsRec<RDS_TTHICK_MIN_ORG$> = ''
		RdsRec<RDS_TRES_MIN_ORG$> = ''
		RdsRec<RDS_TTHICK_UNIF_ORG$> = ''
		RdsRec<RDS_TRES_UNIF_ORG$> = ''
		RdsRec<RDS_TRES_STDEV_ORG$> = ''
		RdsRec<RDS_TW_PROD_ORG$> = ''
		RdsRec<RDS_L_PRE_REJ_LOSS_ORG$> = ''
		RdsRec<RDS_L_POST_REJ_LOSS_ORG$> = ''
		RdsRec<RDS_C_PRE_REJ_LOSS_ORG$> = ''
		RdsRec<RDS_C_POST_REJ_LOSS_ORG$> = ''
		RdsRec<RDS_L_PRE_REJ_CNT_ORG$> = ''
		RdsRec<RDS_L_POST_REJ_CNT_ORG$> = ''
		RdsRec<RDS_C_PRE_REJ_CNT_ORG$> = ''
		RdsRec<RDS_C_POST_REJ_CNT_ORG$> = ''
		RdsRec<RDS_L_PRE_REJ_AC_ORG$> = ''
		RdsRec<RDS_L_POST_REJ_AC_ORG$> = ''
		RdsRec<RDS_C_PRE_REJ_AC_ORG$> = ''
		RdsRec<RDS_C_POST_REJ_AC_ORG$> = ''
		RdsRec<RDS_F_OFFSET_ORG$> = ''
		RdsRec<RDS_S_OFFSET_ORG$> = ''
		RdsRec<RDS_R_OFFSET_ORG$> = ''
		RdsRec<RDS_L_PRE_REJ_NCR_IDS_ORG$> = ''
		RdsRec<RDS_L_POST_REJ_NCR_IDS_ORG$> = ''
		RdsRec<RDS_C_PRE_REJ_NCR_IDS_ORG$> = ''
		RdsRec<RDS_C_POST_REJ_NCR_IDS_ORG$> = ''
		RdsRec<RDS_SRP_PROFILE_PATH_ORG$> = ''
		RdsRec<RDS_DILUENT_ADJ_PARAM_ORG$> = ''
		RdsRec<RDS_HCL_FLOW_ORG$> = ''
		RdsRec<RDS_TCS_FLOW_ORG$> = ''
		RdsRec<RDS_ETCH1_ORG$> = ''
		RdsRec<RDS_ETCH2_ORG$> = ''
		RdsRec<RDS_ETCH3_ORG$> = ''
		RdsRec<RDS_SPEC_TYPE_ORIG$> = ''


		RdsRec<RDS_TW_PPLUS$> = ''
		RdsRec<RDS_TW_PMINUS$> = ''
		RdsRec<RDS_TW_NPLUS$> = ''
		RdsRec<RDS_TW_NMINUS$> = ''
		RdsRec<RDS_TW_PPLUS_CODE$> = ''
		RdsRec<RDS_TW_PMINUS_CODE$> = ''
		RdsRec<RDS_TW_NPLUS_CODE$> = ''
		RdsRec<RDS_TW_NMINUS_CODE$> = ''
		RdsRec<RDS_TW_PPLUS_CNT$> = ''
		RdsRec<RDS_TW_PMINUS_CNT$> = ''
		RdsRec<RDS_TW_NPLUS_CNT$> = ''
		RdsRec<RDS_TW_NMINUS_CNT$> = ''
		RdsRec<RDS_TW_NMINUS_RHO$> = ''
		RdsRec<RDS_TW_NPLUS_RHO$> = ''
		RdsRec<RDS_TW_PMINUS_RHO$> = ''
		RdsRec<RDS_TW_PPLUS_RHO$> = ''
		RdsRec<RDS_TW_PROD_TRANS$> = ''
		RdsRec<RDS_TW_NMINUS_TRANS$> = ''
		RdsRec<RDS_TW_NPLUS_TRANS$> = ''
		RdsRec<RDS_TW_PROD_CODE$> = ''
		RdsRec<RDS_TW_PROD_CNT$> = ''
		RdsRec<RDS_TW_PPLUS_TOOL$> = ''
		RdsRec<RDS_TW_PMINUS_TOOL$> = ''
		RdsRec<RDS_TW_NPLUS_TOOL$> = ''
		RdsRec<RDS_TW_NMINUS_TOOL$> = ''
		RdsRec<RDS_TW_PROD_TOOL$> = ''
		RdsRec<RDS_TW_PPLUS_THICK$> = ''
		RdsRec<RDS_TW_PMINUS_THICK$> = ''
		RdsRec<RDS_TW_NPLUS_THICK$> = ''
		RdsRec<RDS_TW_NMINUS_THICK$> = ''
		RdsRec<RDS_TW_PROD_THICK$> = ''
		RdsRec<RDS_TW_PPLUS_RES$> = ''
		RdsRec<RDS_TW_PMINUS_RES$> = ''
		RdsRec<RDS_TW_NPLUS_RES$> = ''
		RdsRec<RDS_TW_NMINUS_RES$> = ''
		RdsRec<RDS_TW_PROD_RES$> = ''
		RdsRec<RDS_TW_PPLUS_CON$> = ''
		RdsRec<RDS_TW_PMINUS_CON$> = ''
		RdsRec<RDS_TW_NPLUS_CON$> = ''
		RdsRec<RDS_TW_NMINUS_CON$> = ''
		RdsRec<RDS_TW_PROD_CON$> = ''
		RdsRec<RDS_TW_PPLUS_STRESS$> = ''
		RdsRec<RDS_TW_PMINUS_STRESS$> = ''
		RdsRec<RDS_TW_NPLUS_STRESS$> = ''
		RdsRec<RDS_TW_NMINUS_STRESS$> = ''
		RdsRec<RDS_TW_RECLAIM_ORG$> = ''
		RdsRec<RDS_TW_RECLAIM_CODE$> = ''
		RdsRec<RDS_TW_RECLAIM_CNT$> = ''
		RdsRec<RDS_TW_RECLAIM_CON$> = ''
		RdsRec<RDS_TW_RECLAIM_RES$> = ''
		RdsRec<RDS_TW_RECLAIM_RHO$> = ''
		RdsRec<RDS_TW_RECLAIM_STRESS$> = ''
		RdsRec<RDS_TW_RECLAIM_THICK$> = ''
		RdsRec<RDS_TW_RECLAIM_TOOL$> = ''
		RdsRec<RDS_TW_RECLAIM_TRANS$> = ''

		NewSize = LEN(RdsRec)
		
		Delta = OrgSize - NewSize
		ByteTotal += Delta
		
		RecCnt += 1
		Send_Info(RecCnt:' - ':ByteTotal)
		
		IF Delta > 0 THEN
			otParms = FIELDSTORE(otParms,@RM,4,0,RdsRec)
			obj_Tables('WriteRec',otParms)
		END ELSE
			obj_Tables('UnlockRec',otParms)
		END
	
	
	
	END
	
REPEAT

Send_Dyn(RecCnt:' - ':ByteTotal)





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

Return
