|
In the following program, I am noticing that the job status stays ACTIVE and does not change. My question is what should I check in order to see if the job has completed successfully or errored out ? Please help. Thanks Sandeep **************** AS400Test.java *************** import com.ibm.as400.access.*; import com.ibm.as400.security.auth.*; import java.io.*; import java.util.*; public class AS400Test { public static void main(String[] args) { AS400 system = null; try { system = new AS400("SYSTEMNAME", "UserName", "Password"); system.connectService(AS400.COMMAND); CommandCall m_command = new CommandCall(system); if (m_command.run("SBMJOB JOB(TESJOB) CMD(WRKSYSSTS)")) System.out.println("m_command.run is set to true"); else System.out.println("m_command.run is set to false"); AS400Message[] messagelist = m_command.getMessageList(); for (int i = 0; i < messagelist.length; ++i) { System.out.println("MESSAGE IS : " + messagelist[i].getText()); } Job m_job = m_command.getServerJob(); String jobNumber = m_job.getNumber(); String jobstatus = m_job.getStatus(); String jobno = m_job.getNumber(); String jobtype = m_job.getType(); String jobuser = m_job.getUser(); JobLog jl = m_job.getJobLog(); System.out.println("*** JOB INFORMATION*****" + " jobNumber : " + jobNumber + " jobstatus : " + jobstatus + " jobtype : " + jobtype + " jobuser : " + jobuser //" internalJOBID : " + internalID ); while (jl.getLength() <= 0) { System.out.println("Waiting for output"); } AS400Message msg = null; Enumeration msglst = jl.getMessages(); while (msglst.hasMoreElements()) { msg = (AS400Message) msglst.nextElement(); System.out.println(msg.getText()); } // STAYS IN THIS LOOP FOREVER while (m_job.getStatus().equals(m_job.JOB_STATUS_ACTIVE)) { Thread.sleep(10); System.out.println(jobno + " is in : " + m_job.getStatus()); } System.out.println(jobno + " has status of " + m_job.getStatus()); system.disconnectAllServices(); } catch (Exception e) { e.printStackTrace(); } } }
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.