COMPILE ROUTINE FIX_SUB_PART(Dummy)
ROWDEF(CHARSTR)

DECLARE SUBROUTINE Send_Dyn,Send_Info, Send_Dyn, Set_Status, RList, ErrMsg
DECLARE FUNCTION Get_Status, Set_Printer


$INSERT PART_EQUATES
$INSERT	SUB_PART_EQUATES


EQU TARGET_ACTIVELIST$ to 5


OPEN 'PART' TO PartTable ELSE
	ErrMsg('Unable to open PART')
	GOTO Bail
END	

OPEN 'SUB_PART' TO SubPartTable ELSE
	ErrMsg('Unable to open SUB_PART')
	GOTO Bail
END	


SelectSent = 'SELECT SUB_PART WITH PART_NO = ""'

RList(SelectSent,TARGET_ACTIVELIST$, "", "", "")

IF Get_Status(errCode) THEN
	ErrMsg(errCode)
	GOTO Bail
END

DEBUG

RecCnt = 0
Done = 0

LOOP
	READNEXT SubPartNo ELSE Done = 1
UNTIL Done
	READ SubPartRec FROM SubPartTable,SubPartNo THEN
		PartNos = SubPartRec<SUB_PART_PART_NO$>
		IF  PartNos = '' THEN
			DELETE SubPartTable,SubPartNo THEN	
				RecCnt += 1	
				Send_Dyn(RecCnt:' ':SubPartNo:' ':PartNos)
			END
		END	
	END
	
REPEAT






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

END


