All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.data.ProgramCallDocument

java.lang.Object
   |
   +----com.ibm.as400.data.ProgramCallDocument

public class ProgramCallDocument
extends Object
XML Document based program call. The ProgramCallDocument class uses a Program Call Markup Language (PCML) to call AS/400 programs. PCML is an XML language for describing the input and output parameters to the AS/400 program. This class parses a PCML document and allows the application to call AS/400 programs described in the PCML document.

Command Line Interface

The command line interface may be used to serialize PCML document definitions.
 java com.ibm.as400.data.ProgramCallDocument
     -serialize
     pcml document name
 
Options:
-serialize
Parses the PCML document and creates a serialized version of the document. The name of the serialized file will match the document name, and the file extension will be .pcml.ser.

pcml document name
The fully-qualified resource name of the PCML document which defines the program interface.


Constructor Index

 o ProgramCallDocument(AS400, String)
Constructs a ProgramCallDocument

Method Index

 o callProgram(String)
Calls the named program.
 o getErrno(String)
Returns an "errno" value for the named service program element.
 o getIntReturnValue(String)
Returns an int return value for the named service program element.
 o getIntValue(String)
Returns an int value for the named element.
 o getIntValue(String, int[])
Returns an int value for the named element given indices to the data element.
 o getMessageList(String)
Returns the list of AS/400 messages returned from running the program.
 o getOutputsize(String)
Returns the number of bytes reserved for output for the named element.
 o getOutputsize(String, int[])
Returns the number of bytes reserved for output for the named element and indices.
 o getValue(String)
Returns the Java object value for the named element.
 o getValue(String, int[])
Returns the Java object value for the named element given indices to the data element.
 o main(String[])
Provides a command line interface to ProgramCallDocument.
 o serialize()
Serializes the ProgramCallDocument.
 o setIntValue(String, int)
Sets the Java object value for the named element using a int input.
 o setIntValue(String, int[], int)
Sets the Java object value for the named element using an int input value given indices to the data element.
 o setValue(String, int[], Object)
Sets the Java object value for the named element given indices to the data element.
 o setValue(String, Object)
Sets the Java object value for the named element.

Constructors

 o ProgramCallDocument
 public ProgramCallDocument(AS400 sys,
                            String docName) throws PcmlException
Constructs a ProgramCallDocument

Parameters:
sys - The AS400 on which to run the program.
docName - The resource name of the PCML document for the programs to be called.
Throws: PcmlException
when the specified PCML document cannot be found
See Also:
AS400

Methods

 o main
 public static void main(String args[])
Provides a command line interface to ProgramCallDocument. See the class description.

 o callProgram
 public boolean callProgram(String name) throws PcmlException
Calls the named program.

Parameters:
name - The name of the <program> element in the PCML document.
Throws: PcmlException
If an error occurs.
 o getErrno
 public int getErrno(String name) throws PcmlException
Returns an "errno" value for the named service program element.

The named program element must be defined as service program entrypoint. The value returned is the "errno" value resulting from the most recent call to the program. If the program has not been called, zero is returned.

Parameters:
name - The name of the <program> element in the PCML document.
Returns:
The integer "errno" value for the named service program element.
Throws: PcmlException
If an error occurs.
 o getIntReturnValue
 public int getIntReturnValue(String name) throws PcmlException
Returns an int return value for the named service program element.

The named program element must be defined as service program entrypoint. The value returned is the integer return value from the most recent call to the program. If the program has not been called, zero is returned.

Parameters:
name - The name of the <program> element in the PCML document.
Returns:
The integer return value for the named service program element.
Throws: PcmlException
If an error occurs.
 o getIntValue
 public int getIntValue(String name) throws PcmlException
Returns an int value for the named element.

If the named element is String or a Number output value of a program, the value will be converted to an int.

Parameters:
name - The name of the <data> element in the PCML document.
Returns:
The integer value for the named element.
Throws: PcmlException
If an error occurs.
 o getIntValue
 public int getIntValue(String name,
                        int indices[]) throws PcmlException
Returns an int value for the named element given indices to the data element. If the data element is an array or is an element in a structure array, an index must be specified for each dimension of the data.

If the named element is String or a Number output value of a program, the value will be converted to an int.

Parameters:
name - The name of the <data> element in the PCML document.
Returns:
The integer value for the named element.
Throws: PcmlException
If an error occurs.
 o getMessageList
 public AS400Message[] getMessageList(String name) throws PcmlException
Returns the list of AS/400 messages returned from running the program. An empty list is returned if the program has not been run yet.

Returns:
The array of messages returned by the AS/400 for the program.
Throws: PcmlException
If an error occurs.
 o getOutputsize
 public int getOutputsize(String name) throws PcmlException
Returns the number of bytes reserved for output for the named element.

Parameters:
name - The name of the <data> or <struct> element in the PCML document.
Returns:
The number of bytes reserved for output for the named element.
Throws: PcmlException
If an error occurs.
 o getOutputsize
 public int getOutputsize(String name,
                          int indices[]) throws PcmlException
Returns the number of bytes reserved for output for the named element and indices.

Parameters:
name - The name of the <data> or <struct> element in the PCML document.
indices - An array of indices for accessing the output size of an element in an array.
Returns:
The number of bytes reserved for output for the named element.
Throws: PcmlException
If an error occurs.
 o getValue
 public Object getValue(String name) throws PcmlException
Returns the Java object value for the named element.

If the named element is an output value of a program, the value will be converted from AS/400 data to a Java Object.

The type of object returned depends on the description in the PCML document.
PCML DescriptionObject Returned
type=charString
type=bytebyte[]
type=int
length=2
precision=15
Short
type=int
length=2
precision=16
Integer
type=int
length=4
precision=31
Integer
type=int
length=2
precision=32
Long
type=packedBigDecimal
type=zonedBigDecimal
type=float
length=2
Float
type=float
length=4
Double

Parameters:
name - The name of the <data> element in the PCML document.
Returns:
The Java object value for the named <data> element in the PCML document.
Throws: PcmlException
If an error occurs.
 o getValue
 public Object getValue(String name,
                        int indices[]) throws PcmlException
Returns the Java object value for the named element given indices to the data element. If the data element is an array or is an element in a structure array, an index must be specified for each dimension of the data.

If the named element is an output value of a program, the value will be converted from AS/400 data to a Java Object.

The type of object returned depends on the description in the PCML document.
PCML DescriptionObject Returned
type=charString
type=bytebyte[]
type=int
length=2
precision=15
Short
type=int
length=2
precision=16
Integer
type=int
length=4
precision=31
Integer
type=int
length=2
precision=32
Long
type=packedBigDecimal
type=zonedBigDecimal
type=float
length=2
Float
type=float
length=4
Double

Parameters:
name - The name of the <data> element in the PCML document.
indices - An array of indices for accessing the value of an element in an array.
Returns:
The Java object value for the named <data> element in the PCML document.
Throws: PcmlException
If an error occurs.
 o serialize
 public void serialize() throws PcmlException
Serializes the ProgramCallDocument. The filename of the serialized file will be of the form
docName.pcml.ser
where docName.pcml.ser is the name of the document used to construct this object.

Throws: PcmlException
If an error occurs.
 o setIntValue
 public void setIntValue(String name,
                         int value) throws PcmlException
Sets the Java object value for the named element using a int input.

The named element must be able to be set using a Integer object.

Parameters:
name - The name of the <data> element in the PCML document.
value - The int value for the named element.
Throws: PcmlException
If an error occurs.
 o setIntValue
 public void setIntValue(String name,
                         int indices[],
                         int value) throws PcmlException
Sets the Java object value for the named element using an int input value given indices to the data element.

The named element must be able to be set using a Integer object.

Parameters:
name - The name of the <data> element in the PCML document.
indices - An array of indices for setting the value of an element in an array.
value - The int value for the named element.
Throws: PcmlException
If an error occurs.
 o setValue
 public void setValue(String name,
                      Object value) throws PcmlException
Sets the Java object value for the named element.

If the input value provided is not an instance of the correct Java class for the defined data type, it will be converted to the correct Java class. For example, an element defined as "type=int length=2 precision=15", will be converted to a Java Short object. In this case the value specified must be an instance of Number or String.

If the named element is an input value to a program, the value will be converted to AS/400 data when callProgram() is called.

Parameters:
name - The name of the <data> element in the PCML document.
value - The java object value for the named element. The type of Object passed must be the correct type for the element definition or a String that can be converted to the correct type.
Throws: PcmlException
If an error occurs.
 o setValue
 public void setValue(String name,
                      int indices[],
                      Object value) throws PcmlException
Sets the Java object value for the named element given indices to the data element. If the data element is an array or is an element in a structure array, an index must be specified for each dimension of the data.

If the input value provided is not an instance of the correct Java class for the defined data type, it will be converted to the correct Java class. For example, an element defined as "type=int length=2 precision=15", will be converted to a Java Short object. In this case the value specified must be an instance of Number or String.

If the named element is an input value to a program, the value will be converted to AS/400 data when callProgram() is called.

Parameters:
name - The name of the <data> element in the PCML document.
indices - An array of indices for setting the value of an element in an array.
value - The java object value for the named element. The type of Object passed must be the correct type for the element definition or a String that can be converted to the correct type.
Throws: PcmlException
If an error occurs.

All Packages  Class Hierarchy  This Package  Previous  Next  Index