Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

MONMSG in RPGLE

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

  • MONMSG in RPGLE

    Use the MONMSG command as the very first command in the controlling CL. This will monitor for the message throughout the CL program. Dave

  • #2
    MONMSG in RPGLE

    If you are calling a command directly from a RPGILE you can use the system C++ program. Bob Cozzi wrote an article on this about using C++ Robert Cozzi, Jr. "Using C in RPG IV" 4/20/04 6:40am

    Comment


    • #3
      MONMSG in RPGLE

      Hello DKRK, I'm not sure I completely understand your question but I think it is this; "How do you monitor for CPF messages within an RPG program, similiar to how you do it in a CL program." Well, let me tell you, it is certainly easier today at V5R1 and above than it was in previous releases. There are a number of ways to do this. Here are four topics to research and finally an example combining a couple of them: 1) You can create a *PSSR subroutine to handle errors. This will be most capable of capturing most errors that occur in your program. This has been around a while and there should be some examples around. 2)You can trap some exception errors using the (E) operation extender with the %ERROR Built-In Function on a few operation codes. This would apply mostly to file operation codes. Check out the RPG manual for sample solutions. 3) You can use the MONITOR operation code to 'wrap' certain sections of your program to trap errors. This is relatively new and I've been using it quite a bit lately. 4) Use the File Information Data Structure and/or the program status data structure to help capture specific information on the error that is occurring. Okay, with all that said you can do a google search on some of those items to see what you came up with. I did attend a great seminar by Paul Tuohy on this topic. Perhaps you can look for some of his articles. But finally, how about I show you some code rather than ramble off these generic suggestions! Applying Item #3 and #4 from above I do something like this in one of my programs where I execute a call to QCMDEXC...See my code below. Here is a brief description... I define a call to QCMDEXC so I can do a CLRPFM from an RPG program. Define the program status data structure so get the status and exception data if any occurs. Finally, execute your CLRPFM command, 'wrapping' it with the Monitor op-code (which requires a beginning and end) as I've done here. If there is an error/exception the variable ErrMessage will concatenate the zzstatus code with the error text. Then you can send that to the system operator, write to a log file, throw it up on the screen. You choose. Hope this helps...
      Code

      Comment


      • #4
        MONMSG in RPGLE

        thanks jefferson its very useful

        Comment


        • #5
          MONMSG in RPGLE

          In ILE, there is a MONITOR and ENDMON op code that will allow for an error routine to be inserted should an error message occur.

          Comment


          • #6
            MONMSG in RPGLE

            How do you replicate the MONMSG capturing of CL programs in RPGLE? Or how do you capture the Error message of a CLRPFM command given through an RPGLE program?

            Comment

            Working...
            X