ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Using on-excp with diagnostic message

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

  • Using on-excp with diagnostic message

    Hi *,
    I'm trying to make some decision, when scdtime of one of my my daily jobs has passed.
    Program looks like:

    H dftactgrp(*no) actgrp(*caller)
    ************************************************** ***************
    D text S 200
    ************************************************** ***************
    D qcmdexc PR extpgm('QCMDEXC')
    D command 1024 const options(*varsize)
    D comandLength 15 5 const
    D************************************************* ****************
    D*
    /free
    text = 'sbmjob (test_job) cmd(call blablabla) scdtime(100000)';

    monitor;
    qcmdexc(%trimr(text):%len(%trimr(text)));
    on-excp 'CPF1634'; //Specified date or time has passed.
    dsply 'Got U!';
    //TO_DO - run now or don't run
    endmon;

    *inlr = *on;
    /end-free

    This program ends with an error. I can find in joblog (in order: CPF1634 and CPF1338):
    Specified date or time has passed
    Errors occurred on SBMJOB command

    Is there any way to catch the first one (diagnostic) of those messages using on-excp?

  • #2
    Monitor for CPF1338 and if that pops then receive the diagnostic message and check if it is CPF1634

    Comment


    • #3
      Diagnostic messages aren't exceptions... theyre just informational messages (for the purposes of having diagnostic information.) The "on-excp" only monitors for exceptions.

      You can monitor for the exception, and then retrieve the program messages from the program message queue to determine what the diagnostics leading up to the exception were. A good way to do that might be with the QMHRCVPM (receive program message) API, or with the APIs for retrieving the job log.

      But this would all be a lot easier to do from CL, where there are commands like RCVMSG built-in to the language.

      Comment


      • #4
        Thank You (both) for Your replies. I will try it.
        It's a pleasure to see the answer from the man (Mr Scott), who previoulsy was known for me only from his articles

        Comment

        Working...
        X