The ProgramCall class in the micro package (com.ibm.as400.micro.ProgramCall) provides a modified subset of the functions available in the ProgramCall class in the access package (com.ibm.as400.access.ProgramCall). Use the ProgramCall class to enable a Tier0 device to call an iSeries™ program and access the data that is returned after the program runs.
To use the ProgramCall.run() method, you must provide the following parameters:
ProgramCall uses PCML to describe the input and output parameters for the program. The PCML file must be on the same machine as the MEServer, and you must have an entry for the directory that contains the PCML file in the CLASSPATH of that machine.
You must register each PCML document with the MEServer. Registering a PCML document is telling the MEServer which PCML-defined program you want to run. Register the PCML document either during runtime or when you start the MEServer.
For more information about the hashtable that contains program parameters or how to register a PCML document, see the ToolboxME for iSeries ProgramCall javadoc. For more information about PCML, see Program Call Markup Language.
The following example shows how to use the ProgramCall class to use your Tier 0 device to run a program on a server:
// Call programs. AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer"); String pcmlName = "qsyrusri.pcml"; // The PCML document describing the program we want to use. String apiName = "qsyrusri"; Hashtable parametersToSet = new Hashtable(); parametersToSet.put("qsyrusri.receiverLength", "2048"); parametersToSet.put("qsyrusri.profileName", "JOHNDOE" }; String[] parametersToGet = { "qsyrusri.receiver.userProfile", "qsyrusri.receiver.previousSignonDate", "qsyrusri.receiver.previousSignonTime", "qsyrusri.receiver.displaySignonInfo" }; String[] valuesToGet = null; try { valuesToGet = ProgramCall.run(system, pcmlName, apiName, parametersToSet, parametersToGet); // Get and display the user profile. System.out.println("User profile: " + valuesToGet[0]); // Get and display the date in a readable format. char[] c = valuesToGet[1].toCharArray(); System.out.println("Last Signon Date: " + c[3]+c[4]+"/"+c[5]+c[6]+"/"+c[1]+c[2] ); // Get and display the time in a readable format. char[] d = valuesToGet[2].toCharArray(); System.out.println("Last Signon Time: " + d[0]+d[1]+":"+d[2]+d[3]); // Get and display the signon info. System.out.println("Signon Info: " + valuesToGet[3] ); } catch (MEException te) { // Handle the exception. } catch (IOException ioe) { // Handle the exception } // Done with the system object. system.disconnect();