COMPILE ROUTINE TEST_OBJ_SHIPMENT(Dummy) ROWDEF(CHARSTR) DECLARE SUBROUTINE Set_Status, Send_Info, Btree.Extract, obj_Shipment, Send_Dyn DECLARE FUNCTION Get_Status,obj_Schedule, obj_Shipment, FTPList $INSERT COC_EQUATES EQU CRCRLF$ TO \0D0D0A\ EQU CRLF$ TO \0D0A\ EQU TAB$ TO \09\ EnvPath = 'C:\FTP_IN\' DEBUG * * * * * * * JCH Testing of OI's FTP functions * * * * * * * *FtpDomain = '10.131.1.243' ;* Wales *User = 'irep' *Password = 'g6fyi9' *FtpDomain = '10.72.100.40' ;* Temecula & El Segundo *User = 'EPIMesa' *Password = 'irepi01' FtpDomain = '194.90.108.5' User = 'irepi' Password = 'REPii2' Path = '' FileName = '' Error = '' FileList = FTPList(FtpDomain,User,Password,Path,Error) IF Get_Status(errCode) THEN DEBUG END DEBUG IF FileList THEN SWAP CRLF$ WITH '|' IN FileList END ELSE IF Error THEN DEBUG END END GOTO Bail ******* Shipment Releases Inbound ******* InboundPath = EnvPath:'ShipRel\' ;* Get any inbound Product Order Releases InitDir InboundPath:'*.tsv' FileList = DirList() FileNames = '' LOOP FileName = FileList[1,@FM] FileList[1,Col2()] = "" LOCATE FileName IN FileNames BY 'AR' USING @FM SETTING Pos ELSE FileNames = INSERT(FileNames,Pos,0,0,FileName) END UNTIL FileList = "" REPEAT IF FileNames[-1,1] = @FM THEN FileNames[-1,1] = '' Test = '' FileCnt = COUNT(FileNames,@FM) + (FileNames NE '') FOR N = 1 TO FileCnt Send_Info('Processing ':N:' of ':FileCnt) FileName = FileNames StartTime = Time() OSREAD FileIn FROM InboundPath:FileName THEN SWAP TAB$ WITH @VM IN FileIn SWAP CRCRLF$ WITH @FM IN FileIn SWAP CRLF$ WITH @FM IN FileIn LOOP LastChar = FileIn[-1,1] UNTIL LastChar NE @FM FileIn[-1,1] = '' REPEAT RetVal = obj_Shipment('SAPCreate',FileIn) RetVal = 0 IF RetVal = 1 THEN OSDELETE InboundPath:Filename ;* Deletes local copy of inbound file SubDirectory = 'ShipRel' *GOSUB ClearInbound ;* Deletes file on FTP server FromSAP\ProdOrdRel directory END ;* End of check for successful WO_LOG create END NEXT N RETURN ReadCnt = 0 SendCnt = 0 FOR I = 1 TO ShipCnt ShipNo = ShipNos<1,I> CustNo = XLATE('COC',ShipNo,'CUST_NO','X') ReadCnt += 1 LOCATE CustNo IN CustNos USING @VM SETTING Pos THEN *obj_Shipment('SendTechnical',ShipNo) SendCnt += 1 END Send_Info(ReadCnt:' - ':SendCnt) NEXT I Send_Dyn(ReadCnt:' - ':SendCnt) * * * * * * * Bail: * * * * * * * END