FTP

General discussion on the JZOS batch launcher and toolkit
Post Reply
moral
Posts: 7
Joined: Thu Aug 08, 2013 2:24 am

FTP

Post by moral » Fri Nov 22, 2013 1:42 am

Hi
I have a problem with FTP. On mainframe is created data set with xml i send this xml via FTP witen in java. here is the code:

Code: Select all

ZFile zFilePEEout = new ZFile("//DD:PEEOUT", "rb,type=record,noseek");
SendFTP send = new SendFTP(address, user, pass, ftpEnc); 
InputStream input = zFilePEEout.getInputStream(); 
send.uploadFile(input, name, dir);
zFilePEEout.close();
send.disconnect();

Code: Select all

public class SendFTP {
	
	FTPClient ftp = null;
	
	public SendFTP(String host, String user, String pwd, String encFTP) throws Exception{
        ftp = new FTPClient();
        ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
        int reply;
        ftp.connect(host);
        reply = ftp.getReplyCode();
        if (!FTPReply.isPositiveCompletion(reply)) {
             ftp.disconnect();
             throw new Exception("Exception");
        }
        ftp.login(user, pwd);
        ftp.enterLocalPassiveMode();
   }
	
   public void uploadFile(InputStream input, String fileName, String hostDir)
             throws Exception { 
	  this.ftp.storeFile(hostDir + fileName, input); 
   }
 
   public void disconnect(){
        if (this.ftp.isConnected()) {
             try {
                  this.ftp.logout();
                  this.ftp.disconnect();
             } catch (IOException f) {
                 System.out.println("Exception: "+f);
        }
   }
}

Data set which I upload in a few lines have a 1080 charkters but: InputStream input = zFilePEEout.getInputStream(); cut these lines to 1002. Maybe someone know why?
What code use to ftp this data set?

Post Reply