sponsored links



No announcement yet.

Can't show *STATUS messages at the bottom of display station using QMHSNDPM

  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't show *STATUS messages at the bottom of display station using QMHSNDPM

    I am stuck on an issue that should be simple but I can't figure it out.
    I want my rpg ile program to manage a display file and send error messages at the bottom of the display station.
    To do this I call QMHSNDPM from within my interactive program, with the following code:

    D SndPgmMsg2      PR                  ExtPgm('QMHSNDPM')                          
    D   MessageID                    7A   Const                                      
    D   QualMsgF                    20A   Const                                      
    D   MsgData                    256A   Const                                      
    D   MsgDtaLen                   10I 0 Const                                      
    D   MsgType                     10A   Const                                      
    D   CallStkEnt                  10A   Const                                      
    D   CallStkCnt                  10I 0 Const                                      
    D   MessageKey                   4A                                              
    D   ErrorCode                    1A                                              
    D dsEC            DS                                                              
    D  dsECBytesP             1      4B 0 INZ(256)                                    
    D  dsECBytesA             5      8B 0 INZ(0)                                      
    D  dsECMsgID              9     15                                                
    D  dsECReserv            16     16                                                
    D  dsECMsgDta            17    256  
    D wwMsg           S            128A  
    D wwMsgType       S             10A  
    D wwMsgStCall     S             10A  
    D wwMsgStCntr     S              4B 0
    D wwMsgLen        S             10I 0
    D wwMsgKey        S              4A  
    c                   eval      wwMsg = 'some text'      
    c                   eval      wwMsgType = '*STATUS'            
    c                   eval      wwMsgStCall = '*EXT'              
    c                   eval      wwMsgStCntr = 0                  
    c                   callp(e)  SndPgmMsg2('CPF9898'              
    c                                       : 'QCPFMSG   *LIBL'    
    c                                       : %trim(wwMsg)          
    c                                       : wwMsgLen              
    c                                       : wwMsgType            
    c                                       : wwMsgStCall          
    c                                       : wwMsgStCntr          
    c                                       : wwMsgKey              
    c                                       : dsEC                  
    c                                      )
    The code seems to me pretty common and I found it well explained in many articles. I tried CPF9897 as well but nothing changed.

    The display file is compiled with the following options:
    ENHDSP         *YES
    RSTDSP         *YES
    DFRWRT         *YES
    and these are the record format keywords set for the display:
    A          R FMPARM09                                              
    A                                      OVERLAY                    
    A                                      PUTOVR                      
    A                                      OVRDTA
    I can't never get the message be displayed at the bottom of the display station but I cannot find out why.

    Just after I call the API an "exfmt FMPARM09 " is executed.

    What am I missing?

    Thank you

  • #2
    You are passing 0 for wwMsgLen -- so you are telling it to send a zero length string -- no message.

    Try adding a line of code like this prior to the callp:

         c                   eval      wwMsgLen = %len(%trim(wwMsg))
    The display file settings and record format aren't relevant here as far as I can tell?


    • #3
      Hi Scott,
      yes, you are right! I know about the length field to be set, but among the many tries I probably forgot it. Now, it works!
      Thank you.