Java FTP文件到大型机
我正在尝试将JCL txt文件FTP到大型机:Java FTP文件到大型机,java,ftp,mainframe,Java,Ftp,Mainframe,我正在尝试将JCL txt文件FTP到大型机: // Connect to the server ftp.connect(host); replyText = ftp.getReplyString(); System.out.println(replyText); // Log into the server ftp.login(userId, password); replyText = ftp.
// Connect to the server
ftp.connect(host);
replyText = ftp.getReplyString();
System.out.println(replyText);
// Log into the server
ftp.login(userId, password);
replyText = ftp.getReplyString();
System.out.println(replyText);
// Tell the server to use the JES interface
ftp.sendSiteCommand("FILETYPE=JES");
replyText = ftp.getReplyString();
System.out.println(replyText);
//read JCL file in input stream
FileInputStream fileStream = new FileInputStream(file);
String originalFileName = "ca7jcl.txt";
ftp.setFileType(FTP.ASCII_FILE_TYPE);
//store the JCL file
ftp.storeFile(host, fileStream);
replyText = ftp.getReplyString();
System.out.println(replyText);
但是得到250,这是众所周知的未知
如何解决此问题?我假设您希望在FTP'ed时运行JCL文本文件 封闭
try{}
和catch{}
块(如果未完成)
以下是代码(这对我很有用):
让我们知道这是否有帮助。:) 你能展示一下你得到的全部成果吗?好奇地想知道你是否希望它能有所帮助。看起来大型机正在反弹,可能是访问问题或打字错误。它工作正常@BillWoodger您遇到了什么错误?
// FTPClient ftp = new FTPClient(); Assumed in your code
//Connect to the server
try
{
ftp.connect(host);
replyText = ftp.getReplyString();
System.out.println(replyText);
} catch (Exception e) { e.printStackTrace () ; }
//Login to the server
try
{
ftp.login(userId, password);
replyText = ftp.getReplyString();
System.out.println(replyText);
} catch (Exception e) { e.printStackTrace(); }
// Tell the server to use the JES interface
try
{
// Instead of sendSiteCommand()
// ftp.sendSiteCommand("FILETYPE=JES");
// Try site() with everythng in lowercase
ftp.site ("filetype=jes") ;
String replyText = ftp.getReplyString() ;
System.out.println (replyText) ;
} catch (Exception e) { e.printStackTrace(); }
//Submit the job from the text file.Use \\ to avoid using escape notation
try
{
//read JCL file in input stream
//String originalFileName = "ca7jcl.txt";
String path = "" //Store your file's absolute path here
FileInputStream fileStream = new FileInputStream(path);
//store the JCL file
ftp.storeFile(host, fileStream);
replyText = ftp.getReplyString();
System.out.println(replyText);
} catch (Exception e) { e.printStackTrace(); }