This example uses the IBM® Toolbox for Java™ access class CommandCall.
Use the following as an example for your program.
////////////////////////////////////////////////////
//
// This source is an example of "Job List".
//
/////////////////////////////////////////////////////
//
// The access classes are in the com.ibm.as400.access.package.
// Import this package to use the IBM Toolbox for Java classes.
//
/////////////////////////////////////////////////////
import com.ibm.as400.access.*;
public class CmdCall
{
public static void main(String[] args)
{
// Like other Java classes, IBM Toolbox for Java classes
// throw exceptions when something goes wrong. These must
// be caught by programs that use IBM Toolbox for Java.
try Note 1
{
AS400 system = new AS400();
CommandCall cc = new CommandCall(system); Note 2
cc.run("CRTLIB MYLIB"); Note 3
AS400Message[] ml = cc.getMessageList(); Note 4
for (int i=0; i<ml.length; i++)
{
System.out.println(ml[i].getText()); Note 5
}
}
catch (Exception e)
{
e.printStackTrace();
}
System.exit(0);
}
}