• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

[SOLVED] Using vvOut_toJsonPair To Send RPG Error Messages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] Using vvOut_toJsonPair To Send RPG Error Messages

    I am implementing a global error monitoring mechanism for all Valence back end programs. I utilize the QMHRCVPM API to retrieve the entire error message. I would like to send this message back to the user so that they can inform the service desk of the error. However, the IBM messages contain commas and other special characters. It seems the vvOut_toJsonPair command is attempting to format the "message" and truncating the IBM message after the first comma. Here is a sample IBM message:

    Date, Time or Timestamp value is not valid.
    The json response I am seeing in Chrome's network tool is "Date". It seems to stop right at the comma after date. Is there a way around this other than stripping the special characters out of the IBM message?

  • #2
    If you're using toJSONpair, try overriding the default colon and comma separators to something you know won't be in the message. You could use hex codes, for example:
    Code:
         d xColon          c                   const(x'20')
         d xComma          c                   const(x'21')
          /free
           vvOut_toJSONpair('messageId'  + xColon + msgid + xComma +
                            'messageText'+ xColon + msgTxt
                            :xColon:xComma)

    Comment


    • #3
      Thanks Robert! That did the trick! I might just make that my standard vvOut_toJSONpair call.

      Comment

      Working...
      X