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.
-
ProgramCallDocument(AS400, String)
- Constructs a
ProgramCallDocument
-
callProgram(String)
- Calls the named program.
-
getIntValue(String)
- Returns an int value for the named element.
-
getIntValue(String, int[])
- Returns an int value for the named element given indices to the data element.
-
getMessageList(String)
- Returns the list of AS/400 messages returned from running the
program.
-
getOutputsize(String)
- Returns the number of bytes reserved for output for the named element.
-
getOutputsize(String, int[])
- Returns the number of bytes reserved for output for the named element and indices.
-
getValue(String)
- Returns the Java object value for the named element.
-
getValue(String, int[])
- Returns the Java object value for the named element given indices to the data element.
-
main(String[])
- Provides a command line interface to
ProgramCallDocument
.
-
serialize()
- Serializes the ProgramCallDocument.
-
setIntValue(String, int)
- Sets the Java object value for the named element using a int input.
-
setIntValue(String, int[], int)
- Sets the Java object value for the named element using an int input value
given indices to the data element.
-
setValue(String, int[], Object)
- Sets the Java object value for the named element
given indices to the data element.
-
setValue(String, Object)
- Sets the Java object value for the named element.
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
main
public static void main(String args[])
- Provides a command line interface to
ProgramCallDocument
. See the class description.
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.
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.
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.
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.
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.
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.
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 Description | Object Returned |
type=char | String |
type=byte | byte[] |
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=packed | BigDecimal |
type=zoned | BigDecimal |
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.
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 Description | Object Returned |
type=char | String |
type=byte | byte[] |
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=packed | BigDecimal |
type=zoned | BigDecimal |
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.
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.
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.
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.
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.
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