ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Receiving the value from a pgm when prompting my cmd

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

  • Receiving the value from a pgm when prompting my cmd

    Hi!

    I would like to know if there is this possibility with commands:

    I would like to define a parameter whose default value has to be retrieved from a program when the user prompts my command (F4); a kind of choice program but instead of giving a list, sets the parameter's default value.

    Any idea?

    Thanks
    Dom

  • #2
    It's not clear what you're asking because it's not clear why a command needs a default to be returned from a program. It's possibly easier simply to have a default special value like (*PERUSER) or (*LOCATION) or whatever, then have the command processing program (CPP) call the "pseudo-choice program" to replace the special value with the specific default. And if you can't change the existing CPP, then create a new 'wrapper' CPP that replaces the value and calls your current 'CPP' when it finds the assigned special value.

    Maybe if you post a mock-up of your prompted command, the need will be clearer.
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment


    • #3
      If you define the command PARM with the KEYPARM(*YES) keyword, then a prompt control program will get called which can set the values for the KEYPARM parameters. https://www.ibm.com/support/knowledg...mptoverpgm.htm

      The nice thing about showing a customized default value is that the user can change the values before they press ENTER. Imagine using CHGJOB if you couldn't see the current values ...

      Comment


      • #4
        It hadn't occurred to me previously that a KEYPARM() could be specified with a CONSTANT() value and thereby not even be displayed. Used like that, it could make this very practical.
        Tom

        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

        Comment


        • #5
          Believe it or not, while I was writing my second topic because I could not reply to this one, the problem has been fixed..
          Well, in case my second topic will be cancelled, as I have asked, I write my post here, exactly where it should have been:


          BTW I would like to thank both of you for the answers.

          @Barbara, you're perfectly right, that is the reason of my request and you answered perfectly, thanks a lot!

          Comment

          Working...
          X