com.ibm.as400.micro
Class ProgramCall

java.lang.Object
  extended bycom.ibm.as400.micro.ProgramCall

public final class ProgramCall
extends Object

The ProgramCall class allows a user to call an iSeries program and access data returned after the program runs from a wireless device. This class provides a modified subset of the functions available in com.ibm.as400.access.ProgramCall.

Each PCML document must be registered with the MEserver. The document can be registered during runtime when the PCML document name parameter is provided or as an argument when the MEServer is started or reconfigured.

The registration is simply telling the server which PCML-defined program(s) to run.

A hashtable is used to specify the names and values of the parameters to set. The key in the hashtable is the name of the parameter to set and the key value is the value of the corresponding parameter to set. There is also a string array which specifies the name of the PCML output parameter(s) to return.

The following example demonstrates the use of Program Call:

   // Call programs.
   AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer");
   
   // See the PCML example in the Toolbox programmer's guide.
   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();
  

See Also:
ProgramCall

Method Summary
static String[] run(AS400 system, String pcmlName, String program, Hashtable parametersToSet, String[] parametersToGet)
          Constructs a ProgramCall object using the specified system, pgmName, parametersToSet, parameterValues, and parametersToGet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

run

public static String[] run(AS400 system,
                           String pcmlName,
                           String program,
                           Hashtable parametersToSet,
                           String[] parametersToGet)
                    throws IOException,
                           MEException
Constructs a ProgramCall object using the specified system, pgmName, parametersToSet, parameterValues, and parametersToGet.

Parameters:
system - The system on which to run the program.
pcmlName - The name of the PCML document.
program - The name of the program.
parametersToSet - The hashtable containg the key, which is the name of the program parameter, and the key value, which is the corresponding program parameter value..
parametersToGet - The data returned from the program call.
Returns:
the data requested returned from the program. An empty array is returned if no data is returned.
Throws:
IOException - If an error occurs while communicating with the server.
MEException - If an error occurs while processing the ToolboxME request.