ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

RPGLE program. return to caller while setting %error flag to on?

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

  • RPGLE program. return to caller while setting %error flag to on?

    Super newbie question.

    The call op-code for RPGLE sets on Lo flag when called program returns an error as stated here -> https://www.ibm.com/support/knowledg...asd/zzcall.htm

    How does a called program make this happen? I've known from practice passing another variable to hold the error indicator. But the documentation suggests that I could somehow flip this error indicator on. Or %error if called via
    Code:
    call(E)
    Below is super sample program (fixed format)

    Calling program:
    Code:
    c call 'calledprogram'    Lo=95
    c *inlr = *on
    Called program:
    Code:
    c *iner = *on
    c return

    Or is it...

    Called program:
    Code:
    c return 1

  • #2
    The error indicator or %error() turns on in case an error occurs in the called program
    or by calling the program.

    An error in the called program could happen if you fx divided by zero or sending an escape message.

    An error can occur by calling the program if the program called does not exist.

    Comment


    • #3
      If the called program wants to throw its own message back to the caller, it would do so by sending an *ESCAPE message.

      On a side note: The RPG CALL command is old stuff... please consider using prototypes instead.

      Comment


      • #4
        If you want the called program to tell its caller that an error occurred without actually having an exception, you could pass a parameter.

        Comment

        Working...
        X