ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Disable message like inqury

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

  • Disable message like inqury

    There is a CL test program. It has only one command - delete a specific file in a specific library. This program is launched from a C program. When the above file is there, everything goes well: the C program runs the CL program and it deletes the file. However, if the file does not exist, then at startup, for example, from interactive mode, the Display Program Messages window appears and the program waits for my response.
    I tried in a C program to wrap the launch of a CL program in #pragma exception_handler, but this only led to the fact that I was able to handle the exception when the file was missing. I expected not to receive Display Program Messages, however this did not happen.
    Tell me, is it possible to make it so that when executing a CL program, if an exception occurs that is not monitored, the exception handler in the C program is called immediately?

  • #2
    I can't answer the question about exception handling in C, but I'm wondering why you don't add a MONMSG to the CL program.

    Comment


    • #3
      Are the CL and C programs within the same control boundary?

      Comment


      • #4
        About the control boundary that Scott mentioned ...

        If the CL program is an OPM CL program (created with CRTCLPGM), it will issue an inquiry message even if the call is monitored by its caller.

        If you want the pragma exception_handler to handle the error, you will need to compile with CRTBNDCL DFTACTGRP(*NO) ACTGRP(*CALLER). That way, the C program and the CL program will have the same control boundary, and the C program can handle the exception.

        (I am also curious about the same thing as Ted - why not add MONMSG to the CL?)

        Comment


        • #5
          Thanks for answers!
          If the CL program was written by me, then I would of course insert MONMSG. Or used the parameters CRTBNDCL DFTACTGRP (* NO) ACTGRP (* CALLER) during assembly. However, I am using a ready-made program and I have no way to change it.
          Is there any possibility in my case to avoid the request in Display Program Messages, but at the same time "catch" the exception in the C program?

          Comment


          • #6
            If you don't want any inquiry messages to stop your job while your C program is running, you could do
            Code:
            CHGJOB INQMSGRPY(*DFT)
            The default reply for the message will be given automatically, and your exception handler should fire immediately.

            You could save the current setting for INQMSGRPY before you change it, and restore it to its old value at the end of your C program.

            Comment


            • #7
              Barbara, thanks for the advice!

              Comment

              Working...
              X