【问题标题】:FTP file to MainframeFTP 文件到大型机
【发布时间】:2015-03-22 07:20:43
【问题描述】:

我正在尝试将 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.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-JES 将其称为 *UNKNOWN 我该如何解决这个问题?

【问题讨论】:

  • 你能显示你得到的完整输出吗?

标签: java ftp mainframe


【解决方案1】:

我假设你想在 FTP 上运行你的 JCL 文本文件。

附上try {}catch {} 块(如果未完成)。

这是代码(这对我有用):

// 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(); } 

如果这有帮助,请告诉我们。 :)

【讨论】:

  • 很想知道您是否希望它有所帮助。看起来大型机正在弹跳它,可能是访问问题或错字。
  • 它工作正常@BillWoodger 你遇到什么错误?
猜你喜欢
  • 2010-10-30
  • 1970-01-01
  • 2012-10-31
  • 1970-01-01
  • 2013-05-20
  • 1970-01-01
  • 1970-01-01
  • 2019-04-15
  • 1970-01-01
相关资源
最近更新 更多