V4.2.0 SIGANL ON USER seems not to invoke NAMEd routine

2014-03-26
2014-03-27
  • Robert Schreiber

    ooRexx V4.2.0 (64 bit)

    When I execute this small test program the procedure 'OOPS' is not invoked as I expect. Either this is a bug or I am doing something subtle wrong. Any suggestions? Am I missing something here?

    I found this closed item in the support area that seems related: #783 Signal on User and Any fail to trap user conditions

    Here is the program and a sample execution:

    C:\Safe-Back\ReXX>type test.rex
    TRACE ALL
    SIGNAL ON USER INVUTF8 NAME OOPS
    SAY 'HI 1'
    CALL TEST_FUNC
    SAY 'HI 2'
    EXIT 0
    OOPS:
    SAY 'HANDLING ERROR OOPS'
    EXIT 16
    TEST_FUNC: PROCEDURE
    SAY 'HI 21'
    RAISE USER INVUTF8
    SAY 'HI 22'
    RETURN

    C:\Safe-Back\ReXX>rexx -v
    Open Object Rexx Version 4.2.0
    Build date: Feb 22 2014
    Addressing Mode: 64

    Copyright (c) IBM Corporation 1995, 2004.
    Copyright (c) RexxLA 2005-2013.
    All Rights Reserved.
    This program and the accompanying materials are made available under
    the terms of the Common Public License v1.0 which accompanies this
    distribution or at
    http://www.oorexx.org/license.html

    C:\Safe-Back\ReXX>rexx test.rex
    2 - SIGNAL ON USER INVUTF8 NAME OOPS
    3 - SAY 'HI 1'
    HI 1
    4 - CALL TEST_FUNC
    10 - TEST_FUNC:
    10 - PROCEDURE
    11 - SAY 'HI 21'
    HI 21
    12 - RAISE USER INVUTF8

    C:\Safe-Back\ReXX>

    Since SAY 'HI 22' did not occur then its clear that ooRexx correctly stopped the called procedure. What I would next expect is that SAY 'HI 2' would not be executed (and it wasn't) and then an entry into label OOPS:, but that did not occur. Instead the program just halted as if label OOPS: could not be found.

    The ooRexx Reference, CHpater 11, page 609 states:
    "If a condition trap is enabled and the specified condition or usercondition occurs, control passes to the routine or label trapname if you have specified trapname."

    bob

     
    Last edit: Robert Schreiber 2014-03-26
    • Rick McGuire

      Rick McGuire - 2014-03-26

      ERROR! The markdown supplied could not be parsed correctly. Did you forget to surround a code snippet with "~~~~"?

      The RAISE instruction acts like an EXIT instruction, which terminates the
      current call level and raise the condition with the caller.  Since you are
      just using internal calls, this exits your program and there is no
      high-level program with an active error trap that can trap the condition.
       If you make your test_func a ::routine, the call to that is an external
      routine call, so when it issues the RAISE, that level is terminated and
      your trap can get control.
      
      TRACE ALL
      SIGNAL ON USER INVUTF8 NAME OOPS
      SAY 'HI 1'
      CALL TEST_FUNC
      SAY 'HI 2'
      EXIT 0
      OOPS:
      SAY 'HANDLING ERROR OOPS'
      EXIT 16
      ::routine test_func
      SAY 'HI 21'
      RAISE USER INVUTF8
      SAY 'HI 22'
      RETURN
      
      
      
      On Wed, Mar 26, 2014 at 2:14 PM, Robert Schreiber <tallbob@users.sf.net>wrote:
      
      > ooRexx V4.2.0 (64 bit)
      >
      > When I execute this small test program the procedure 'OOPS' is not invoked
      > as I expect. Either this is a bug or I am doing something subtle wrong. Any
      > suggestions? Am I missing something here?
      >
      > I found this closed item in the support area that seems related: #783
      > Signal on User and Any fail to trap user conditions
      >
      > Here is the program and a sample execution:
      >
      > C:\Safe-Back\ReXX>type test.rex
      > TRACE ALL
      > SIGNAL ON USER INVUTF8 NAME OOPS
      > SAY 'HI 1'
      > CALL TEST_FUNC
      > SAY 'HI 2'
      > EXIT 0
      > OOPS:
      > SAY 'HANDLING ERROR OOPS'
      > EXIT 16
      > TEST_FUNC: PROCEDURE
      > SAY 'HI 21'
      > RAISE USER INVUTF8
      > SAY 'HI 22'
      > RETURN
      >
      > C:\Safe-Back\ReXX>rexx -v
      > Open Object Rexx Version 4.2.0
      > Build date: Feb 22 2014
      > Addressing Mode: 64
      >
      > Copyright (c) IBM Corporation 1995, 2004.
      > Copyright (c) RexxLA 2005-2013.
      > All Rights Reserved.
      > This program and the accompanying materials are made available under
      > the terms of the Common Public License v1.0 which accompanies this
      > distribution or at
      > http://www.oorexx.org/license.html
      >
      > C:\Safe-Back\ReXX>rexx test.rex
      >      2 *-* SIGNAL ON USER INVUTF8 NAME OOPS
      >      3 *-* SAY 'HI 1'
      > HI 1
      >      4 *-* CALL TEST_FUNC
      >     10 *-*   TEST_FUNC:
      >     10 *-*   PROCEDURE
      >     11 *-*   SAY 'HI 21'
      > HI 21
      >     12 *-*   RAISE USER INVUTF8
      >
      > C:\Safe-Back\ReXX>
      >
      > Since SAY 'HI 22' did not occur then its clear that ooRexx correctly
      > stopped the called procedure. What I would next expect is that SAY 'HI 2'
      > would not be executed (and it wasn't) and then an entry into label OOPS:,
      > but that did not occur.  Instead the program just halted as if label OOPS:
      > could not be found.
      >
      > The ooRexx Reference, CHpater 11, page 609 states:
      > "If a condition trap is enabled and the specified condition or
      > usercondition occurs, control passes to the routine or label trapname if
      > you have specified trapname."
      >
      > bob
      >
      >
      > ---
      >
      > [V4.2.0 SIGANL ON USER seems not to invoke NAMEd routine](
      > https://sourceforge.net/p/oorexx/discussion/408477/thread/a1fa54bd/?limit=25#01a6
      > )
      >
      >
      > ---
      >
      > Sent from sourceforge.net because you indicated interest in <
      > https://sourceforge.net/p/oorexx/discussion/408477/>
      >
      > To unsubscribe from further messages, please visit <
      > https://sourceforge.net/auth/subscriptions/>
      >
      
       
  • Robert Schreiber

    Ahhh... I tried you suggested fix and it did, in fact, work as I expected. My mistake was thinking that RAISE acted like RETURN, not EXIT. In the Reference Manual on page 72 it says "RAISE returns or exits from the currently running routine or method and raises a condition in the caller (for a routine) or sender (for a method)." which lead my thinking down the wrong path.

    Could you update the manual to be more clear about how RAISE works. An example or two would be helpful.

    THANK YOU for your quick and accurate help.

    bob

     
    • Rick McGuire

      Rick McGuire - 2014-03-27

      ERROR! The markdown supplied could not be parsed correctly. Did you forget to surround a code snippet with "~~~~"?

      I was revisiting this, and realized that the behavior depends on whether
      you specify the RETURN or EXIT keyword.  If you just add the RETURN keyword
      to your RAISE instruction in your original program, this will work as you
      expected.
      
      Rick
      
      
      On Wed, Mar 26, 2014 at 3:05 PM, Robert Schreiber <tallbob@users.sf.net>wrote:
      
      > Ahhh...  I tried you suggested fix and it did, in fact, work as I
      > expected. My mistake was thinking that RAISE acted like RETURN, not EXIT.
      > In the Reference Manual on page 72 it says "RAISE *returns* or exits from
      > the currently running routine or method and raises a condition in the
      > caller (for a routine) or sender (for a method)." which lead my thinking
      > down the wrong path.
      >
      > Could you update the manual to be more clear about how RAISE works. An
      > example or two would be helpful.
      >
      > THANK YOU for your quick and accurate help.
      >
      > bob
      >
      >
      > ---
      >
      > [V4.2.0 SIGANL ON USER seems not to invoke NAMEd routine](
      > https://sourceforge.net/p/oorexx/discussion/408477/thread/a1fa54bd/?limit=25#1e4b
      > )
      >
      >
      > ---
      >
      > Sent from sourceforge.net because you indicated interest in <
      > https://sourceforge.net/p/oorexx/discussion/408477/>
      >
      > To unsubscribe from further messages, please visit <
      > https://sourceforge.net/auth/subscriptions/>
      >
      
       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks