Announcement

Collapse
No announcement yet.

Weird printer file and activation group behavior

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

  • Weird printer file and activation group behavior

    I ran into something weird yesterday. I wonder if anybody here has seen this, and even better, knows what causes it.

    I have an RPG program with an externally described printer file in it. The printer file has two record formats (page headers and detail line) and the RPG program has two WRITE’s. If I call the RPG program from a command line or under SBMJOB, it runs normally.

    I need to put a call to this program in a new CL program. I compiled both programs to run in the same named activation group. However, the RPG program doesn’t work correctly. It writes the page headers, but when it tries to execute the second WRITE, it immediately cancels and returns to the CL caller at the label referred to in the global MONMSG. The RPG program has a global monitor too, but the global monitor code never kicks in.

    However, if I compile the CL program and RPG program to run in different named activation groups, the RPG program runs normally when called by the CL program.

    Any idea what could cause this strange behavior?


  • #2
    Maybe issue in code.

    Comment


    • #3
      I think CL's MONMSG monitors for status and notify messages as well as escape messages. But RPG exception handlers only monitor for escape messages. If the RPG program gets a notify or status message, its own handlers wouldn't catch the message, but the MONMSG in the same actgrp would catch it.

      Comment


      • #4
        Ted, you could try adding a CEEHDLR handler to your RPG program. I believe the handler gets called for NOTIFY, STATUS, and ESCAPE messages.

        But I'm not sure how to distinguish between the types of messages in the condition token that gets passed to the handler.

        Comment


        • #5
          In case anybody's interested . . .

          I found the problem. The printer file was created with a page size of 66 x 132, but the record format on which the program was canceling was 135 bytes long.

          The WRITE was generating *NOTIFY message CPF4906 - Record in file MYPRTF truncated at end of line.

          I used the green-screen debugger, and while I was stopped at the global monitor routine in the CL program, I pressed F21 and looked at the job log. The *NOTIFY message was there. When the program ended, the message was not in the job log.

          Barbara was right -- the system was not sending an *ESCAPE message.

          Comment

          Working...
          X