COMPILE ROUTINE BUILD_SapShipRel_DATA(Dummy)
ROWDEF(CHARSTR)


DECLARE SUBROUTINE ErrMsg, Send_Info, SetInitDirOptions, Send_Dyn, Set_Status


DECLARE FUNCTION Get_Status,Security_Check, Set_Status
DECLARE FUNCTION Repository, Send_Dyn

$INSERT COC_EQUATES
$INSERT WO_MAT_EQUATES
$INSERT PART_EQUATES

EQU CRLF$ TO \0D0A\
EQU TAB$ TO \09\


ShipNos = 97500:@VM:97600:@VM:96100

ShipCnt = 3

DEBUG

FOR I = 1 TO 1
	ShipNo = ShipNos<1,I>
	ShipRec = XLATE('COC',ShipNo,'','X')
	
	WONo	= ShipRec<COC_WO$>
	CassNos	= ShipRec<COC_CASS_NO$>
	ProdOrdNo = 'M':FMT(WONo, "R(0)#6"):'.1'
	CassWfrQtys = XLATE('COC',ShipNo,'CASS_WAFER_CNT','X')
	
	ShipRelease = ''
	
	CassCnt = COUNT(CassNos,@VM) + (CassNos NE '')
	
	FOR Cass = 1 TO CassCnt
		ShipRelLine		 	= ShipNos<1,I>
		ShipRelLine<1,2>	= ProdOrdNo
		ShipRelLine<1,3>	= WONo
		ShipRelLine<1,4>	= CassNos<1,Cass>
		ShipRelLine<1,5>	= 'B':RND(1945)
		ShipRelLine<1,6>	= CassWfrQtys<1,I>
		
		ShipRelease<-1> = ShipRelLine
		
	NEXT Cass

	* * * *   Write Work Order Release    * * * *
	
	ProdOrdRelease = 'M000010.1':@VM:'PO001TEST':@VM:'03/30/11':@VM:'737883':@VM:'516956-C-IR':@VM:'1':@VM:'100':CRLF$
	
	SWAP @FM WITH CRLF$ IN ProdOrdRelease
	SWAP @VM WITH TAB$ IN ProdOrdRelease

	
	FullPath = 'C:\FTP_IN\ProdOrdRel\'
	FileName = 'PR':FMT(I,"R(0)#5"):'.tsv'
	
	Set_Status(0)
	
	OSWRITE ProdORdRelease TO FullPath:FileName
	
	
NEXT I

END


