COMPILE ROUTINE FIX_SCHEDULE(Dummy)
ROWDEF (CHARSTR)

DECLARE SUBROUTINE SEND_INFO, SEND_DYN

equ SCHEDULE_PO$ 				to 1
equ SCHEDULE_ORDER_NO$ 			to 2
equ SCHEDULE_CUST_NO$ 			to 3
equ SCHEDULE_ENTRY_ID$ 			to 4
equ SCHEDULE_STATUS$ 			to 5
equ SCHEDULE_ENTRY_DATE$ 		to 6
equ SCHEDULE_CLOSE_DATE$ 		to 7
equ SCHEDULE_ORDER_LINE$ 		to 8
equ SCHEDULE_PART_NUM$ 			to 9
equ SCHEDULE_LOT_NUM$ 			to 10
equ SCHEDULE_WO$ 				to 11
equ SCHEDULE_RUN_ORDER_NUM$	 	to 12
equ SCHEDULE_RDS_IDS$ 			to 13
equ SCHEDULE_WAFERS_IN$			to 14
equ SCHEDULE_QUOTE_NUM$			to 15
equ SCHEDULE_WAFER_REC_DATE$	to 16
equ SCHEDULE_SCHED_QTY$ 		to 17
equ SCHEDULE_SCHED_DATE$ 		to 18
equ SCHEDULE_SHIP_QTY$ 			to 19
equ SCHEDULE_SHIP_DATE$ 		to 20
equ SCHEDULE_NOTES$ 			to 21
equ SCHEDULE_INVOICE_IDS$ 		to 22
equ SCHEDULE_SHIP_VIA$ 			to 23
equ SCHEDULE_TRACKING_NO$ 		to 24
equ SCHEDULE_SHIP_SETUP_CHARGE$ to 25
equ SCHEDULE_SHIP_SRP_CHARGE$ 	to 26
equ SCHEDULE_SHIP_PRICE$ 		to 27
equ SCHEDULE_REJECTS$ 			to 28
equ SCHEDULE_UNPROCESSED$		to 29
equ SCHEDULE_BOX_CNT$			to 30
equ SCHEDULE_QXJ$ 				to 31
equ SCHEDULE_PROD_SPEC_ID$ 		to 32

OPEN "SCHEDULE" TO TableIn ELSE
	Send_Info('Puked on table open')
	GOTO Bail
END

InvNos = '122281,122289,122294,122296,122297,1222303,1222304'
Convert ',' To @VM IN InvNos

InvNoCnt = COUNT(InvNos,@VM) + (InvNos NE '')

Select TableIn

Done		= 0
RecCnt		= 0
SchedNos	= ''

LOOP
	READNEXT SchedNo ELSE Done = 1
UNTIL Done
	READ SchedRec FROM TableIn,SchedNo THEN
		RecCnt += 1
		PrintRec = SchedNos
		Send_Info(RecCnt)
		FOR I = 1 TO InvNoCnt
			InvNo = InvNos<1,I>
			LOCATE InvNo IN SchedRec<SCHEDULE_INVOICE_IDS$> USING @VM Setting Pos THEN
				Send_Dyn('Sched No: ':SchedNo:' - Inv No: ':InvNo)
			END
		NEXT I 
	END 
REPEAT



Send_Dyn(SchedNos)



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

END
