如何在entrepreneedt.net.ftp.FileTransferClient中传递大型机文件名

时间:2012-03-03 03:05:37

标签: java ftp mainframe

我正在尝试使用com.enterprisedt.net.ftp.FileTransferClient从ftp服务器下载文件,文件名是“ABC.DEF.GHI.JKL(0)”,这是一个大型机文件,它是一个有效的文件名(用大型机管理员检查。)

    public static void main(String[] args) {

    // extract command-line arguments
    String host = "111.111.111.111";
    String username = "bbbbbbbb";
    String password = "cccccccccp";
    String filename = "ABC.DEF.GHI.JKL(0)";

    // set up logger so that we get some output
    Logger log = Logger.getLogger(ConnectToServer.class);
    Logger.setLevel(Level.INFO);

    FileTransferClient ftp = null;

    try {
        // create client
        log.info("Creating FTP client");
        ftp = new FileTransferClient();

        // set remote host
        log.info("Setting remote host");
        ftp.setRemoteHost(host);
        ftp.setUserName(username);
        ftp.setPassword(password);

        // connect to the server
        log.info("Connecting to server " + host);
        ftp.connect();
        log.info("Connected and logged in to server " + host);

        //Downloading file from server
        log.info("Downloading file");
        ftp.downloadFile(filename+".copy", filename);
        log.info("File downloaded");

        // Shut down client
        log.info("Quitting client");
        ftp.disconnect();

        log.info("Example complete");

    } catch (Exception e) {
        e.printStackTrace();
    }
}

我收到的错误是:

ERROR [FTPClient] 2 Mar 2012 21:44:08.359 : Caught and rethrowing exception in initGet() : Invalid data set name "ABC.DEF.GHI.JKL(0)". Use MVS Dsname conventions. com.enterprisedt.net.ftp.FTPException: 501 Invalid data set name "ABC.DEF.GHI.JKL(0)". Use MVS Dsname conventions. at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:1223) at com.enterprisedt.net.ftp.FTPClient.initGet(FTPClient.java:3109) at com.enterprisedt.net.ftp.FTPClient.getData(FTPClient.java:3156) at com.enterprisedt.net.ftp.FTPClient.getFile(FTPClient.java:2970) at com.enterprisedt.net.ftp.FTPClient.get(FTPClient.java:2356) at com.enterprisedt.net.ftp.FileTransferClient.downloadFile(FileTransferClient.java:703) at com.enterprisedt.net.ftp.FileTransferClient.downloadFile(FileTransferClient.java:683) at com.bluecrossma.ConnectToServer.main(ConnectToServer.java:47)

请建议我如何解决此问题。

先谢谢

1 个答案:

答案 0 :(得分:3)

在此链接中找到答案:torsas.ca/attachments/File/03012008/FTP_Fileref.pdf只需在双引号内添加单引号。谢谢各位。