Discuss (FTP) and (SFTP, FTPS and SCP), our Java file transfer clients.
no avatar
User

cathrop

Posts

4

Joined

Tue Feb 19, 2013 1:15 am

FTP of text file to a mainframe server arrives unreadable

by cathrop » Thu Feb 21, 2013 3:04 am

Using Edtftpj to ftp files from a Unix server to a mainframe (3270) server. The files are text (ASCII) and I am setting the FTPTransferType to ASCII (ftp.setType(FTPTransferType.ASCII);).

The files have an extension of .pct and are unreadable when they get to the mainframe server.



If I send the same file from the command line it arrives readable or if I change the extension to .txt it arrives readable.

Is there something else I need to set in Edtftpj?
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: FTP of text file to a mainframe server arrives unreadabl

by support2 » Thu Feb 21, 2013 11:09 pm

Post the debug log from the command line client - it should be easy to configure edtFTPj to do the same.
no avatar
User

cathrop

Posts

4

Joined

Tue Feb 19, 2013 1:15 am

Turns out sending as Binary worked. This is what I found...

by cathrop » Fri Feb 22, 2013 4:52 am

Did command line FTP with debug on. Didn't really get any debug info but when I turned on ASCII the file FTP'd as unreadable. So I decided to try sending it in Binary, and what do you know, it FTP'd as readable text. So I tried the same thing in by Java Edtftpj program and it FTP'd in readable fashion also. So I guess my problem is solved. But I find it interesting that sending a text file with a picture extension (.pct) in binary arrives at the mainframe server in text (readable) fashion.

btw, not sure if you saw the reply to my other post about being able to grab the Edtftpj info/debug output that goes to the console in a string so I can add it to an email.
You replied with:
Logger.addAppender(new StreamAppender(myStream));

I tried that without success. Here is the reply to your reply to my other post:

Thanks for your quick reply. Sorry for not fully grasping, am somewhat new to Java and ftp using "Edtftpj".
For testing and a better understanding have created 3 Appenders:

Logger.setLevel(Level.ALL);
Logger.addAppender(new FileAppender("c:\\output.log"));
Logger.addAppender(new StandardOutputAppender());
Logger.addAppender(new StreamAppender(Edtftpj.outStream));

I have set up the outStream and a get method:

public String getOutStream() {
return outStream.toString();
}

private static OutputStream outStream = new OutputStream() {
private StringBuilder string = new StringBuilder();
public void write(int b) throws IOException {
this.string.append((char) b );
}

public String toString(){
return this.string.toString();
}
};

But it returns nothing. What am I doing wrong?

This is what I am trying to grab in a string:

INFO [Edtftpj] 21 Feb 2013 13:21:30.914 : Connecting at 01:21:30 PM
DEBUG [FTPClient] 21 Feb 2013 13:21:30.915 : Connecting to BLDCLAIM.BOULDER.IBM.COM/9.17.210.22:21
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.114 : 220-FTPD1 IBM FTP CS V1R13 at BLDCLAIM.BOULDER.IBM.COM, 18:21:27 on 2013-02-21.
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.115 : 220 Connection will close if idle for more than 5 minutes.
INFO [Edtftpj] 21 Feb 2013 13:21:31.118 : Logging in at 01:21:31 PM
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.119 : ---> USER SSFPACT
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.210 : 331 Send password please.
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.211 : ---> PASS ********
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.406 : 230 SSFPACT is logged on. Working directory is "SSFPACT.".
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.407 : ---> TYPE I
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.495 : 200 Representation type is Image
INFO [Edtftpj] 21 Feb 2013 13:21:31.496 : Putting file at 01:21:31 PM
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.496 : ---> PWD
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.585 : 257 "'SSFPACT.'" is working directory.
DEBUG [FTPClient] 21 Feb 2013 13:21:31.586 : Attempt #1
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.590 : ---> PASV
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.681 : 227 Entering Passive Mode (9,17,210,22,224,85)
INFO [FTPControlSocket] 21 Feb 2013 13:21:31.681 : Substituting server supplied IP (9.17.210.22) with remote host IP (9.17.210.22)
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.779 : ---> STOR SSFa3448.pct
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:31.893 : 125 Storing data set SSFPACT.SSFA3448.PCT
DEBUG [FTPClient] 21 Feb 2013 13:21:31.894 : Transferred 65636 bytes to remote host
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:32.374 : 250 Transfer completed successfully.
INFO [Edtftpj] 21 Feb 2013 13:21:32.414 : Quitting client at 01:21:32 PM
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:32.414 : ---> QUIT
DEBUG [FTPControlSocket] 21 Feb 2013 13:21:32.505 : 221 Quit command received. Goodbye.
INFO [Edtftpj] 21 Feb 2013 13:21:32.507 : FTP complete at 01:21:32 PM
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Turns out sending as Binary worked. This is what I foun

by support2 » Fri Feb 22, 2013 2:50 pm

This is a flushing problem.

You need to close the StreamAppender, which flushes the internal PrintWriter writing to the output stream.

Once that is closed the output stream will have all the logging.

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron