diff --git a/src/main/java/com/ibm/as400/data/PcmlDocument.java b/src/main/java/com/ibm/as400/data/PcmlDocument.java index d0ccc2ef3..b90ff4b6c 100644 --- a/src/main/java/com/ibm/as400/data/PcmlDocument.java +++ b/src/main/java/com/ibm/as400/data/PcmlDocument.java @@ -590,6 +590,15 @@ synchronized AS400Message[] getMessageList(String name) throws PcmlException return getProgramNode(name).getMessageList(); } + /** + Returns the option for how many messages will be retrieved for the specified program. + @return A constant indicating how many messages will be retrieved. + **/ + synchronized int getMessageOption(String name) throws PcmlException + { + return getProgramNode(name).getMessageOption(); + } + /** Returns the ProgramCall object that was used in the most recent invocation of {@link #callProgram() callProgram()}. @return The ProgramCall object; null if callProgram has not been called. @@ -692,6 +701,18 @@ boolean getThreadsafeOverride(String program) // @C6A return getProgramNode(program).getThreadsafeOverride(); // @C6A } // @C6A + /** + Specifies the option for how many messages should be retrieved for the specified program. By default, to preserve + compatability, only the messages sent to the program caller and only up to ten messages are retrieved. + This property will only take effect on systems that support the new option. + @param messageOption A constant indicating how many messages to retrieve. + **/ + synchronized void setMessageOption(String program, int messageOption) + throws PcmlException + { + getProgramNode(program).setMessageOption(messageOption); + } + // Add a subtree to the document's hashtable. // This is called to complete the document cloneing process. void addToHashtable(PcmlDocNode newChild) // @C5A diff --git a/src/main/java/com/ibm/as400/data/PcmlProgram.java b/src/main/java/com/ibm/as400/data/PcmlProgram.java index 7c52d3315..265feaad1 100644 --- a/src/main/java/com/ibm/as400/data/PcmlProgram.java +++ b/src/main/java/com/ibm/as400/data/PcmlProgram.java @@ -15,6 +15,7 @@ import com.ibm.as400.access.AS400; import com.ibm.as400.access.AS400Message; +import com.ibm.as400.access.ExtendedIllegalArgumentException; import com.ibm.as400.access.ProgramCall; import com.ibm.as400.access.ServiceProgramCall; // @B1A import com.ibm.as400.access.ProgramParameter; @@ -91,6 +92,7 @@ class PcmlProgram extends PcmlDocNode private AS400Message[] msgList; // Array of AS400Message @C1C private int m_IntReturnValue; // Int return value for a service program call @B1A @C1C private int m_Errno; // Errno for a service program call @B1A @C1C + private int m_MessageOption; /** */ @@ -102,6 +104,7 @@ public PcmlProgram() m_IntReturnValue = 0; // @C1A m_Errno = 0; // @C1A m_ThreadsafeOverrideCalled = false; // @D2A + m_MessageOption = AS400Message.MESSAGE_OPTION_UP_TO_10; } // Constructor @@ -116,6 +119,7 @@ public PcmlProgram(PcmlAttributeList attrs) // @C3C m_IntReturnValue = 0; // @C1A m_Errno = 0; // @C1A m_ThreadsafeOverrideCalled = false; // @D2A + m_MessageOption = AS400Message.MESSAGE_OPTION_UP_TO_10; // ********************************** // Set attribute values @@ -682,6 +686,8 @@ else if (getEntrypoint() != null) // @D1A m_pgmCall.setThreadSafe(getThreadsafeOverride()); // @C6A } + m_pgmCall.setMessageOption(getMessageOption()); + // // Call the target program // @@ -692,11 +698,15 @@ else if (getEntrypoint() != null) // @D1A if (Trace.isTraceOn()) Trace.log(Trace.PCML, "Completed program call: " + m_pgmCall.getProgram()); // - // If the program signalled a message, save the message list. + // Save the message list in all cases + // + msgList = m_pgmCall.getMessageList(); + + // + // If the program signaled a message, stop processing here. // if (m_pgmRc != true) { - msgList = m_pgmCall.getMessageList(); return m_pgmRc; } @@ -883,6 +893,21 @@ AS400Message[] getMessageList() return msgList; } + int getMessageOption() + { + return m_MessageOption; + } + + void setMessageOption(int messageOption) + { + // Validate the messageOption parameter. + if (messageOption < 0 || messageOption > 2) + { + throw new ExtendedIllegalArgumentException("messageOption (" + messageOption + ")", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID); + } + m_MessageOption = messageOption; + } + /** Returns whether or not this element is defined as a service program entrypoint. diff --git a/src/main/java/com/ibm/as400/data/ProgramCallDocument.java b/src/main/java/com/ibm/as400/data/ProgramCallDocument.java index d4a258879..8e72b0ffb 100644 --- a/src/main/java/com/ibm/as400/data/ProgramCallDocument.java +++ b/src/main/java/com/ibm/as400/data/ProgramCallDocument.java @@ -790,6 +790,25 @@ public AS400Message[] getMessageList(String name) return m_pcmlDoc.getMessageList(name); } + /** + Returns the option for how many messages will be retrieved for the specified program. + + @param name The name of the <program> element in the PCML document. + @return A constant indicating how many messages will be retrieved. Valid values are: +