The modifyexample.txt script shows how to call Java methods from inside the FTP scripts and how to execute a batch/shell program before sending the file to the FTP server. The batch/shell program calls a Java program that modifies the document by adding CRLF (\r\n) at the end of the document. The
executePutCmd method is then executed to store the file at the FTP server.
This script is the same as putexample.txt except for one minor change. Before connecting to the FTP server, the source file name, which is a reference to the file that is stored locally before the script execution takes place, is sent to the
executeProgram method in the
RunProgram class. This method sends the
fileName reference to a batch/shell program
BC_HOME\samples\bc\ftpscripts\bcfilemodifier.bat. The batch file/shell program calls the Java class
ModifyFile, which adds a CRLF at the end of the document file that is being transferred to the FTP server. Once the file is modified it is stored on the FTP server that is available to the trading partner.
If you want to perform a full round trip of your transaction, you can upload mgetexample.txt from the first example to retrieve the files from the FTP server so that the Responder trading partner can process the document that was uploaded after the modification.