com.ibm.as400.access

Class AS400Message

  • java.lang.Object
    • com.ibm.as400.access.AS400Message
  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    QueuedMessage


    public class AS400Message
    extends java.lang.Object
    implements java.io.Serializable
    Represents a message returned from an IBM i system. A Java program does not normally create AS400Message objects directly. Instead, AS400Message objects are created and returned by various other IBM Toolbox for Java components.
    Some attributes are only available as the result of a command or program call. Refer to the individual getXXX method to see if the attribute is only available as the result of a command or progam call.
    Usage hint: To fully "prime" an AS400Message object with additional information that otherwise might not be returned from the system, call the load() method. For example, if getHelp() returns null, try preceding the getHelp() with a call to load().
    See Also:
    AS400Exception, CommandCall, ProgramCall, SpooledFile, Serialized Form
    • Field Detail

      • COMPLETION

        public static final int COMPLETION
        Message type for completion messages.
        See Also:
        Constant Field Values
      • DIAGNOSTIC

        public static final int DIAGNOSTIC
        Message type for diagnostic messages.
        See Also:
        Constant Field Values
      • INFORMATIONAL

        public static final int INFORMATIONAL
        Message type for informational messages.
        See Also:
        Constant Field Values
      • INQUIRY

        public static final int INQUIRY
        Message type for inquiry messages.
        See Also:
        Constant Field Values
      • SENDERS_COPY

        public static final int SENDERS_COPY
        Message type for sender's copy messages.
        See Also:
        Constant Field Values
      • REQUEST

        public static final int REQUEST
        Message type for request messages.
        See Also:
        Constant Field Values
      • REQUEST_WITH_PROMPTING

        public static final int REQUEST_WITH_PROMPTING
        Message type for request with prompting messages.
        See Also:
        Constant Field Values
      • NOTIFY

        public static final int NOTIFY
        Message type for notify (exception already handled when API is called) messages.
        See Also:
        Constant Field Values
      • ESCAPE

        public static final int ESCAPE
        Message type for escape (exception already handled when API is called) messages.
        See Also:
        Constant Field Values
      • NOTIFY_NOT_HANDLED

        public static final int NOTIFY_NOT_HANDLED
        Message type for notify (exception not handled when API is called) messages.
        See Also:
        Constant Field Values
      • ESCAPE_NOT_HANDLED

        public static final int ESCAPE_NOT_HANDLED
        Message type for escape (exception not handled when API is called) messages.
        See Also:
        Constant Field Values
      • REPLY_NOT_VALIDITY_CHECKED

        public static final int REPLY_NOT_VALIDITY_CHECKED
        Message type for reply, not validity checked messages.
        See Also:
        Constant Field Values
      • REPLY_VALIDITY_CHECKED

        public static final int REPLY_VALIDITY_CHECKED
        Message type for reply, validity checked messages.
        See Also:
        Constant Field Values
      • REPLY_MESSAGE_DEFAULT_USED

        public static final int REPLY_MESSAGE_DEFAULT_USED
        Message type for reply, message default used messages.
        See Also:
        Constant Field Values
      • REPLY_SYSTEM_DEFAULT_USED

        public static final int REPLY_SYSTEM_DEFAULT_USED
        Message type for reply, system default used messages.
        See Also:
        Constant Field Values
      • REPLY_FROM_SYSTEM_REPLY_LIST

        public static final int REPLY_FROM_SYSTEM_REPLY_LIST
        Message type for reply, from system reply list messages.
        See Also:
        Constant Field Values
      • MESSAGE_OPTION_UP_TO_10

        public static final int MESSAGE_OPTION_UP_TO_10
        Constant for the option indicating up to ten messages sent to the caller should be returned. For compatibility, this option is the default. Only messages sent to the caller will be returned, messages sent by the invoked procedure to itself will not be returned.
        See Also:
        Constant Field Values
      • MESSAGE_OPTION_NONE

        public static final int MESSAGE_OPTION_NONE
        Constant for the option indicating that no messages should be returned.
        See Also:
        Constant Field Values
      • MESSAGE_OPTION_ALL

        public static final int MESSAGE_OPTION_ALL
        Constant for the option indicating all the messages should be returned. All messages sent from invocation beginning to invocation end will be returned. Systems not supporting this new option will revert to the behavior specified for option MESSAGE_OPTION_UP_TO_10.
        See Also:
        Constant Field Values
    • Method Detail

      • getDate

        public java.util.Calendar getDate()
        Returns the date and time the message was sent. The returned Calendar object will have the following fields set:
        • Calendar.YEAR
        • Calendar.MONTH
        • Calendar.DAY_OF_MONTH
        • Calendar.HOUR
        • Calendar.MINUTE
        • Calendar.SECOND
        Returns:
        The date and time the message was sent, or null if not applicable.
      • getDefaultReply

        public java.lang.String getDefaultReply()
        Returns the default reply.
        Returns:
        The default reply, or null if it is not set.
      • getFileName

        public java.lang.String getFileName()
        Returns the message file name.
        Returns:
        The message file name, or null if it is not set.
      • getHelp

        public java.lang.String getHelp()
        Returns the message help.

        Message formatting characters may appear in the message help and are defined as follows:

        • &N - Force the text to a new line indented to column 2. If the text is longer than 1 line, the next lines should be indented to column 4 until the end of the text or another format control character is found.
        • &P - Force the text to a new line indented to column 6. If the text is longer than 1 line, the next lines should start in column 4 until the end of the text or another format control character is found.
        • &B - Force the text to a new line starting in column 4. If the text is longer than 1 line, the next lines should start in column 6 until the end of the text or another format control character is found.
        Usage hint: If getHelp() returns null, try "priming" the AS400Message object by first calling load(), then getHelp().
        Returns:
        The message help, or null if it is not set.
      • getID

        public java.lang.String getID()
        Returns the message ID.
        Returns:
        The message ID, or null if it is not set.
      • getLibraryName

        public java.lang.String getLibraryName()
        Returns the message file library.
        Returns:
        The message file library, or null if it is not set.
      • getPath

        public java.lang.String getPath()
        Returns the full integrated file system path name of the message file.
        Returns:
        The full integrated file system path name of the message file name, or null if it is not set.
      • getSeverity

        public int getSeverity()
        Returns the message severity.
        Returns:
        The message severity. Valid values are between 0 and 99, or -1 if it is not set.
      • getSubstitutionData

        public byte[] getSubstitutionData()
        Returns the substitution data. This is unconverted data used to fill in the replacement characters in the message. To convert the data to something useful, see the CharConverter class for String conversions (CHAR fields) and the BinaryConverter class for integer (BIN fields) and other numeric conversions.
        Returns:
        The subsitution data, or null if not set.
      • getText

        public java.lang.String getText()
        Returns the message text with the substitution text inserted.
        Returns:
        The message text, or null if it is not set.
      • getType

        public int getType()
        Returns the message type.
        Returns:
        The message type, or negative one (-1) if it is not set. Valid values are:
        • COMPLETION
        • DIAGNOSTIC
        • INFORMATIONAL
        • INQUIRY
        • SENDERS_COPY
        • REQUEST
        • REQUEST_WITH_PROMPTING
        • NOTIFY
        • ESCAPE
        • REPLY_NOT_VALIDITY_CHECKED
        • REPLY_VALIDITY_CHECKED
        • REPLY_MESSAGE_DEFAULT_USED
        • REPLY_SYSTEM_DEFAULT_USED
        • REPLY_FROM_SYSTEM_REPLY_LIST
      • toString

        public java.lang.String toString()
        Returns the message ID and message text.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The message ID and message text.
      • getCreateDate

        public java.util.Date getCreateDate()
        Returns the messages create date
        Returns:
        the createDate_
      • setCreateDate

        public void setCreateDate(java.util.Date createDate_)
        Sets the messages create date
        Parameters:
        createDate_ - the createDate_ to set
      • getModificationDate

        public java.util.Date getModificationDate()
        Returns the messages last modification date
        Returns:
        the modificationDate_
      • setModificationDate

        public void setModificationDate(java.util.Date modificationDate_)
        Sets the messages last modification date
        Parameters:
        modificationDate_ - the modificationDate_ to set
      • setKey

        public void setKey(byte[] key)
        Set the message key.
        Parameters:
        key -
      • getKey

        public byte[] getKey()
        Returns the 4-byte message key.. The message key is usually only available from messages returned by a command or program call.
        Returns:
        key
      • setMessageFileLibrarySpecified

        public void setMessageFileLibrarySpecified(java.lang.String library)
        Set the MessageFileLibrarySpecified.
        Parameters:
        library -
      • getMessageFileLibrarySpecified

        public java.lang.String getMessageFileLibrarySpecified()
        Get the message file library specified. This is usually only available from messages returned by a command or program call.
        Returns:
        library name
      • setSendingProgramName

        public void setSendingProgramName(java.lang.String programName)
        Set the sending program name
        Parameters:
        programName -
      • getSendingProgramName

        public java.lang.String getSendingProgramName()
        Get the sending program name. This is usually only available from messages returned by a command or program call.
        Returns:
        program name
      • setSendingProgramInstructionNumber

        public void setSendingProgramInstructionNumber(java.lang.String instructionNumber)
        Set the sending program instruction number.
        Parameters:
        instructionNumber -
      • getSendingProgramInstructionNumber

        public java.lang.String getSendingProgramInstructionNumber()
        Get the sending program instruction number. This is usually only available from messages returned by a command or program call.
        Returns:
        instruction number
      • setReceivingProgramName

        public void setReceivingProgramName(java.lang.String programName)
        Set the receiving program name.
        Parameters:
        programName -
      • getReceivingProgramName

        public java.lang.String getReceivingProgramName()
        Get the receiving program name. This is usually only available from messages returned by a command or program call.
        Returns:
        program name
      • setReceivingProgramInstructionNumber

        public void setReceivingProgramInstructionNumber(java.lang.String instructionNumber)
        set the receiving program instruction number
        Parameters:
        instructionNumber -
      • getReceivingProgramInstructionNumber

        public java.lang.String getReceivingProgramInstructionNumber()
        Get the receiving program instruction number. This is usually only available from messages returned by a command or program call.
        Returns:
        instruction number
      • setSendingType

        public void setSendingType(java.lang.String sendingType)
        Set the sending type of the program
        Parameters:
        sendingType -
      • getSendingType

        public java.lang.String getSendingType()
        Get the type of the sender (whether it is a program or procedure). Possible values and their meanings are as follow:
        • 0 Sender is an original program model (OPM) program or a System Licensed Internal Code (SLIC) program with up to and including 12 characters in its name.
        • 1 Sender is a procedure within an ILE program, and the procedure name is up to and including 256 characters in length.
        • 2 Sender is a procedure within an ILE program, and the procedure name is from 257 characters up to and including 4096 characters in length. For this type, the sending procedure name is blank and the name is unavailable.
        • 3 Sender is a SLIC program with 13 or more characters in its name. For this type, the sending program name is blank, and the name is unavailable.
        The type is usually only available from messages returned by a command or program call.
        Returns:
        sendingType
      • setReceivingType

        public void setReceivingType(java.lang.String receivingType)
        set the receiving type
        Parameters:
        receivingType -
      • getReceivingType

        public java.lang.String getReceivingType()
        Get the type of the receiver (whether it is a program or procedure). Possible values and their meanings are as follow:
        • 0 Sender is an original program model (OPM) program or a System Licensed Internal Code (SLIC) program with up to and including 12 characters in its name.
        • 1 Sender is a procedure within an ILE program, and the procedure name is up to and including 256 characters in length.
        • 2 Sender is a procedure within an ILE program, and the procedure name is from 257 characters up to and including 4096 characters in length. For this type, the sending procedure name is blank and the name is unavailable.
        • 3 Sender is a SLIC program with 13 or more characters in its name. For this type, the sending program name is blank, and the name is unavailable.
        The type is usually only available from messages returned by a command or program call.
        Returns:
        receiving type
      • setTextCcsidConversionStatusIndicator

        public void setTextCcsidConversionStatusIndicator(int conversionStatusIndicator)
        set the text ccsid conversion status indicator.
        Parameters:
        conversionStatusIndicator -
      • getTextCcsidConversionStatusIndicator

        public int getTextCcsidConversionStatusIndicator()
        Get the text ccsid conversion status indicator. The following values may be returned:
        • 0 No conversion was needed because the CCSID of the message or message help text matched the CCSID you wanted the message or message help text converted to.
        • 1 No conversion occurred because either the message or message help text was 65535 or the CCSID you wanted the message or message help text converted to was 65535.
        • 2 No conversion occurred because you did not supply enough space for the message or message help text.
        • 3 The message or message help text was converted to the CCSID specified using the best fit conversion tables.
        • 4 A conversion error occurred using the best fit conversion tables so a default conversion was attempted. This completed without error.
        • -1 An error occurred on both the best fit and default conversions. The text was not converted.
        This is usually only available from messages returned by a command or program call.
        Returns:
        conversion status indicator
      • setDataCcsidConversionStatusIndicator

        public void setDataCcsidConversionStatusIndicator(int conversionStatusIndicator)
        set the data ccsid conversion status indicator.
        Parameters:
        conversionStatusIndicator -
      • getDataCcsidConversionStatusIndicator

        public int getDataCcsidConversionStatusIndicator()
        Get the data ccsid conversion status indicator. The following values may be returned:
        • 0 No conversion was needed because the CCSID of the message or message help text matched the CCSID you wanted the message or message help text converted to.
        • 1 No conversion occurred because either the message or message help text was 65535 or the CCSID you wanted the message or message help text converted to was 65535.
        • 2 No conversion occurred because you did not supply enough space for the message or message help text.
        • 3 The message or message help text was converted to the CCSID specified using the best fit conversion tables.
        • 4 A conversion error occurred using the best fit conversion tables so a default conversion was attempted. This completed without error.
        • -1 An error occurred on both the best fit and default conversions. The text was not converted.
        This is usually only available from messages returned by a command or program call.
        Returns:
        status indicator
      • setAlertOption

        public void setAlertOption(java.lang.String alertOption)
        set the alert option
        Parameters:
        alertOption -
      • getAlertOption

        public java.lang.String getAlertOption()
        Get the alert option Whether and when an SNA alert is created and sent for the message. If a message is received, the value is one of the following:
        • *DEFER An alert is sent after local problem analysis.
        • *IMMED An alert is sent immediately when the message is sent to a message queue that has the allow alerts attribute set to *YES.
        • *NO No alert is sent.
        • *UNATTEND An alert is sent immediately when the system is running in unattended mode (when the value of the alert status network attribute, ALRSTS, is *UNATTEND)..
        This is usually only available from messages returned by a command or program call.
        Returns:
        alert option
      • equals

        public boolean equals(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object