The CommandCall class in the micro package (com.ibm.as400.micro.CommandCall) provides a modified subset of the functions available in the CommandCall class in the access package (com.ibm.as400.access.CommandCall). Use the CommandCall class to call an iSeries™ command from a Tier0 device.
The CommandCall run() method requires a String (the command you want to run) and returns any messages resulting from running the command as a String. If the command completes but does not generate any messages, the run() method returns an empty String array.
The following example demonstrates how you can use CommandCall:
// Work with commands. AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer"); try { // Run the command "CRTLIB FRED." String[] messages = CommandCall.run(system, "CRTLIB FRED"); if (messages != null) { // Note that there was an error. System.out.println("Command failed:"); for (int i = 0; i < messages.length; ++i) { System.out.println(messages[i]); } } else { System.out.println("Command succeeded!"); } } catch (Exception e) { // Handle the exception } // Done with the system object. system.disconnect();