我正在尝试获取有关AS400中一组对象的创建日期和时间的信息。我在AS400中使用DSPOBJD创建了一个outfile。下面是用于获取有关一个对象的信息的代码段。现在,在此之后,我将不得不打开与AS400的连接并查询outfile以获取创建日期和时间。我想知道有更好的方法。
String serverIP="XXX.XX.XXX.XX";
String userName="UserId";
String password="Password";
String commandString="DSPOBJD OBJ(ABCD) OBJTYPE(*PGM) OUTPUT(*OUTFILE)
OUTFILE(Library/FileName) OUTMBR(*FIRST *ADD)";
AS400 as400=null;
try
{
as400=new AS400(serverIP,userName,password);
CommandCall command = new CommandCall(as400);
System.out.println("Executing Command "+commandString);
boolean success = command.run(commandString);
if(success)
{
System.out.println("Executed Successfully");
}
else
{
System.out.println("Encountered Error");
}
AS400Message [] messageList=command.getMessageList();
for(AS400Message message:messageList)
{
System.out.println(message.getText());
}
System.out.println("Deleting Object");
Thread.sleep(10000);
command.run("DLTOBJ OBJ(Library/FileName) OBJTYPE(*FILE)");
System.out.println("Deleted...");
}
catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
as400.disconnectAllServices();
} catch(Exception e)
{System.out.println("Excpetion in closing connection: ");
e.printStackTrace();
}}
提前致谢!!
答案 0 :(得分:0)
我做了类似的事情以获得对象的大小。
AS400 as400 = new AS400(iseries, login, password);
ObjectDescription aFile = new ObjectDescription(as400, library, fileName, "FILE", iasp);
if (aFile.exists()) {
aFile.refresh();
aFile.getValue(ObjectDescription.CREATION_DATE);
aFile.getValue(ObjectDescription.OBJECT_SIZE);
}