ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Get the active message ID in OAR handler

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

  • Get the active message ID in OAR handler

    Hi Everyone,

    I'm writing an OAR handler for a DSPF. There are a large number of messages defined in the DSPF by keyword ERRMSGID and they are controlled by indicators. And I need to get the message ID that is active from the OAR handler so that it could be passed back to the caller program. Is there any way I could get it except checking the indicators?

    DSPF:
    HTML Code:
         A          R RCDFMT1
         A                                      TEXT('Detail Screen')
         A                                      CA01
         A  05                                  CA03
         A  02                                  CA23
         A                                      HELP(10)
         A                                      BLINK
         A                                      LOCK
         A            FLD001    R        O  1 14REFFLD(FLD1)
         A  98 96N91
         AAN92 93 94
         AA 95N07                               ERRMSGID(MSG0001 *LIBL/MSGF)
         A  98 96N91
         AA 92N93N94
         AAN95N07                               ERRMSGID(MSG0002 *LIBL/MSGF)
         A  98 96N91
         AA 92N93N94
    ......


    RPGLE:
    HTML Code:
    ......
         FFILE1     CF   E             WORKSTN INFSR(*PSSR)
                                                  HANDLER(HLDPGM)
    ......
         C                   IF              FLD001 = 'ABC'
         C                   MOVE      *ON            *IN98
         C                   MOVE      *ON            *IN96
         C                   MOVE      *OFF          *IN91
         C                   MOVE      *OFF          *IN92
         C                   MOVE      *ON            *IN93
         C                   MOVE      *ON            *IN94
         C                   MOVE      *ON             *IN95​

  • #2
    Not that I can think of. That is handled by workstation data management - RPG never sees it and so has no way of communicating that to you.

    I will say to you what I have said to many others before you. If you are trying to write an OA handler to deal with any display file you throw at it you are wasting time and money. Far cheaper and more effective to buy such a solution from Profound, or Rocket, or ... These people have spent millions of $s and countless years understanding the inner content of display files and accommodating them within their tools. It is not a trivial task. You've discovered just one minor example of the potential problems. What about overlapping indicator-controlled fields? And any number of other "nasties".

    If on the other hand, you are trying to make it possible for old-style RPGers to write web apps while staying in RPG then you need to constrain the use of the DDS to things that can be controlled within RPG. In other words (for this example) use a single indicator-controlled message and retrieve the appropriate error text within the RPG code.

    You are using a very (very) old style of RPG - some 25+ years out of date basically - so I'm hoping that the latter situation I presented is the one you are aiming at. If it is the former then your problems are only just beginning.

    I've written quite a lot about OA - including the development of a standard template program to simplify the process. You can find many of those articles here: https://authory.com/JonParisAndSusan...on=Open-Access

    Comment


    • Samuel Zhang
      Samuel Zhang commented
      Editing a comment
      Hi Jon, thanks a lot for your comments!
Working...
X