JD Edwards

JD Edwards
Lokesh Reddy Blog

Wednesday, October 11, 2017

Non-JDE WIndows FTP File Deletion from JDE using Batch File

FTP File Deletion 
Listing Named ER for Function: FTPFileDeletion
Listing of ER for Named ER: N5601001


=======================================================================
NAMED ER:
=======================================================================
evt_HEIszFTPFileName_VAR1
evt_HEIszFTPRecord_VAR1
evt_HEIidGenericLong_VAR1
OPT: Using Defaults
// **************************************************************
// Added Logic for FTP File Deletion
// By Lokesh on 9/10/2017
// **************************************************************
VA evt_HEIszFTPFileName_VAR1 = concat(ltrim(rtrim([BF HEIszE1ServerPath_NFLF],' '),' '),concat(concat("/",rtrim(ltrim([BF HEIszCommandFileName_FILENAME],' '),' ')),".bat"))
Replace Character in String
   VA evt_HEIszFTPFileName_VAR1 -> BF szInputString
   VA evt_HEIszFTPFileName_VAR1 <- BF szOutputString
   "/" -> BF cReplCharOld
   "\" -> BF cReplCharNew
Open Flat File
   BF HEIcErrorCode <- BF cErrorCode
   VA evt_HEIidGenericLong_VAR1 <- BF idFilePtr
   VA evt_HEIszFTPFileName_VAR1 -> BF szFilePath
//
If VA evt_HEIidGenericLong_VAR1 is greater than <Zero>
   //
   VA evt_HEIszFTPRecord_VAR1 = "@echo off"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "echo user svcbase.ftp01> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "echo Heineken1122>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "echo bin>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = concat("echo cd ",concat(ltrim(rtrim([BF HEIszFTPServerPath_NFLF],' '),' ')," >>ftpcmd.dat"))
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = concat("echo delete ",concat(ltrim(rtrim([BF HEIszCommandFileName_FILENAME],' '),'')," >>ftpcmd.dat"))
   Replace Character in String
      VA evt_HEIszFTPRecord_VAR1 -> BF szInputString
      VA evt_HEIszFTPRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "echo quit>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "ftp -n -s:ftpcmd.dat 10.12.66.17"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "del ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   //
   Close Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
   //
   Execute External Program
      BF HEIcErrorCode <- BF cErrorCode
      VA evt_HEIszFTPFileName_VAR1 -> BF szCommandLine
   //
!    Time to sleep
!       "15000" -> BF szSleepTimeString
   Delete Or Copy Flat File
      VA evt_HEIszFTPFileName_VAR1 -> BF szOriginalFlatFile
      "1" -> BF cActionOnFlatFiles
End If
// **************************************************************
// Added Logic for FTP File Deletion
// By Lokesh on 9/10/2017
// **************************************************************

No comments:

Post a Comment