如何从java使用FTP在大型机上创建数据集
我正在尝试使用java将文本文件FTP到大型机。我可以使用下面的代码在PDS中创建一个成员如何从java使用FTP在大型机上创建数据集,java,ftp,mainframe,Java,Ftp,Mainframe,我正在尝试使用java将文本文件FTP到大型机。我可以使用下面的代码在PDS中创建一个成员 //Function to FTP the report public void sendReport() throws IOException { FTPSClient ftp = null; InputStream in = null; String protocol="TLS"; //Connecting to mainframe
//Function to FTP the report
public void sendReport() throws IOException
{
FTPSClient ftp = null;
InputStream in = null;
String protocol="TLS";
//Connecting to mainframe server for ftp transfer
ftp = new FTPSClient(protocol);
ftp.connect(hostname);
ftp.login(user,password);
ftp.execPBSZ(0);
ftp.execPROT("P");
ftp.enterLocalPassiveMode();
ftp.setFileType(FTP.ASCII_FILE_TYPE);
int reply = ftp.getReplyCode();
System.out.println("Received Reply from FTP Connection:" + reply);
if (FTPReply.isPositiveCompletion(reply))
System.out.println("Connected To Mainframe");
else
System.out.println("Not connected to Mainframe..Check ID or Password");
//Setting mainframe PDS for reports
boolean success = ftp.changeWorkingDirectory("***Mainframe Directory***");
if (success)
System.out.println("Successfully changed PDS.");
else
System.out.println("Failed to change PDS. See Mainframe's reply.");
//Sending Report to mainframe PDS
File f1 = new File(dkReportName);
in = new FileInputStream(f1);
boolean done = ftp.storeFile("DKI"+dkReportName.substring(14,18), in);
in.close();
if (done)
System.out.println("FILE FTP SUCCESSFUL");
else
System.out.println("FILE FTP NOT SUCCESSFUL");
ftp.logout();
ftp.disconnect();
}
正在appContext.xml中设置用户、密码和主机名变量。但是,我想创建一个PS数据集。
任何人都可以建议一种方法。根据您的问题,这是针对MVS文件空间的,而不是USS 使用FTP创建数据集时,需要向主机提供有关文件大小、属性等的信息 这列出了可以执行以设置传输的命令列表。基本顺序如下:
site cyl
site pri=5
site sec=5
site recfm=fb
您可以在一行中组合多个命令:
站点lrecl=80 blksize=3120
在传输之前执行这些命令,文件应分配给您所需的特征 根据您的编码示例,这里有一个应该可以使用的示例:
ftp.sendCommand("site",
"cyl pri=5 sec=5 recfm=fb filetype=seq lrecl=80 blksize=3120");