我想使用java程序爲我的物理文件創建日記。AS/400創建日誌JT400(Java)
a)我們如何通過傳遞模式名稱來獲得現有的日記名稱和描述。 例如:DSPFD FILE(SCHEMA_NAME/TABLE_NAME)命令正在成功執行,但在java控制檯中沒有輸出。
b)我們如何讀取表格的實際名稱並在java控制檯中顯示。
在此先感謝。
/**
* Test program to test the AS/400 Command from Java.
*/
public static void main(String[] args) {
String server = "SERVER1";
String user = "USER_ID";
String pass = "PWD_ABC";
String getjournalcmd = "DSPFD FILE(SCHEMA_NAME/TABLE_NAME) OUTPUT(*PRINT)";
String createjournalcmd = "STRJRNPF FILE(SCHEMA_NAME/TABLE_NAME) JRN(SCH_JRN_LIB_NAME/JRN_NAME)";
AS400 as400 = null;
try {
// Create an AS400 object
as400 = new AS400(server, user, pass);
// Create a Command object
CommandCall command = new CommandCall(as400);
// Run the command.
System.out.println("Executing: " + getjournalcmd);
boolean success = command.run(getjournalcmd);
if (success) {
System.out.println("Command Executed Successfully.");
} else {
System.out.println("Command Failed!");
}
// Get the command results
AS400Message[] messageList1 = command.getMessageList();
System.out.println(messageList1.length);
for (AS400Message message : messageList1) {
System.out.println(message.getText());
}
// Create journal
System.out.println("Executing: " + createjournalcmd);
boolean success1 = command.run(createjournalcmd);
if (success1) {
System.out.println("Command Executed Successfully.");
} else {
System.out.println("Command Failed!");
}
// Get the command results
AS400Message[] messageList = command.getMessageList();
System.out.println(messageList.length);
for (AS400Message message : messageList) {
System.out.println(message.getText());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// Make sure to disconnect
as400.disconnectAllServices();
} catch (Exception e) {
}
}
System.exit(0);
}
謝謝回覆。能否請你與我分享示例代碼。 –