ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Set On K1 - K9 Indicators in RPG Program ?

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

  • Set On K1 - K9 Indicators in RPG Program ?

    Is it possible to set on a command key indicator in an RPG program ?
    I need to make a copy of an existing program, to execute a specific block of code.
    It's a clunky old program and I want it to force exit, as if the user hit CMD-3 at a specific point.

    EDIT: Looks like this will work EVAL *INKC = '1'
    Last edited by MFisher; August 26, 2021, 11:11 AM.

  • #2
    EDIT: Looks like this will work EVAL *INKC = '1'

    Comment


    • #3
      I would be surprised if that did not work. So will EVAL *INKC = *ON

      Comment


      • #4
        You can't seton *INKC

        According to the manual:
        KA through KN and KP through KY can be used as resulting indicators only with the SETOFF operation
        (RPG Reference V7R3 page 130)

        Comment


        • #5
          Could you add an ordinary indicator field, and set it on when you want to set INKC on, and then when it tests INKC to see if it should end, also check your own indicator.

          If you currently have this:
          Code:
             if *inkc;
                *inlr = *on;
                return;
             endif;
          Add these:
          Code:
          dcl-s end_now ind inz(*off);
          ...
             end_now = *on;
          And change the *INKC "if" statement to this:
          Code:
             if *inkc or end_now;
                *inlr = *on;
                return;
             endif;

          Comment

          Working...
          X