COMPILE ROUTINE FIX_RDS_Layer_Index(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 obj_Tables, obj_RDS2
DECLARE FUNCTION Get_Status, Set_Printer, obj_RDS, ErrMsg, obj_Tables

$INSERT RDS_EQU
$INSERT WO_LOG_EQU
$INSERT ORDER_EQU
$INSERT PROD_SPEC_EQU
$INSERT RDS_LAYER_EQUATES

EQU TARGET_ACTIVELIST$ TO 5


OPEN 'RDS_LAYER' TO FileIn ELSE
	debug
	GOTO Bail
END

OPEN 'RDS' TO RDSTable ELSE
	debug
	GOTO Bail
END

SELECT FileIn



LockedRecords = ''
Done = 0
RecCnt = 0
LOOP
	READNEXT LayerKey ELSE Done = 1
UNTIL DONE
	READ LayerRec FROM FileIn,LayerKey THEN
		RDSNo = LayerRec<RDS_LAYER_RDS_NO$>
		RelatedKeys = XLATE('RDS',RDSNo,RDS_RDS_LAYER_KEYS$,'X')
		LOCATE LayerKey IN RelatedKeys USING @VM SETTING POS ELSE
			Send_Dyn(LayerKey)
		END
		RecCnt += 1
	
		Send_Info(RecCnt)
	END
REPEAT

DEBUG


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

END
