Non Subfile Field Not Changing When Doing an EXFMT

200 pts.
Tags:
RPG
RPG debugging
RPG ILE
RPG IV
RPG/400
RPGLE
This should be a simple thing to do but it is not working. I have an RPG program in which the user enters a warehouse code and presses enter. If the code is valid, it then populates a field in the record with the warehouse description. If the user changes the code to an invalid warehouse, I turn on an indicator and blank out the warehouse description. I then do an exfmt. The error message appears but the code description does not change to blanks. I debugged the program and it showed the field was blank just before I did the exfmt. If the field is blank, why does it still show the old description?

Software/Hardware used:
as400, V5R4

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hard to say without seeing the DDS nor the relevant program code.

My first guess, from the DSPF DDS manual under the ERRMSG/ERRMSGID keywords:<ul>
<li>When a message is displayed because of either the ERRMSG or the ERRMSGID keyword, all fields on the display are kept, including the field the message is associated with. Except for option indicators, data in the output buffer is ignored (that is, any new data from the program is not sent to the display).</li>
</ul>
Tom

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • GHENDER
    Thanks a lot! I have been programming for years and I never knew that. I put in another exfmt before I turned on the indicator and the new description appeared. Of course this means that the user will have to press ENTER an additional time. Is there another way to get around this?
    200 pointsBadges:
    report
  • Sloopy
    Yes, there are other ways to do this. Because of the restrictions and peculiarities of the ERRMSG and ERRMSGID DDS keywords, many places use a message subfile at the bottom of the screen, and display their messages there. This does not affect the EXFMT operation (and it has plenty of other advantages too). Once you've coded message subfile handling into your screen DDS and program, the code is easy to propagate and resuse elsewhere. The DDS is like this:
    A          R D@MSGSFL                   SFL                            
    A                                       TEXT('Message Subfile Record') 
    A                                       SFLMSGRCD(24)                  
    A            D#SMK                      SFLMSGKEY                      
    A            D#SPQ                      SFLPGMQ                        
                                                                           
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
                                                                           
    A          R D@MSGCTL                   SFLCTL(D@MSGSFL)               
    A                                       TEXT('Message Subfile Control')
    A                                       OVERLAY                        
    A                                       SFLDSP                         
    A                                       SFLINZ                         
    A N01                                   SFLEND                         
    A                                       SFLSIZ(2)                      
    A                                       SFLPAG(1)                      
    A            D#SPQ                      SFLPGMQ                        
    
    The code in the program is like this:
     * ------------------------------------------------------------------------             
     * Message handling data structures                                                     
     * ------------------------------------------------------------------------             
                                                                                            
    D p_MsgRtnCode    S              7                                         Return code  
    D p_MsgPgmName    S             10                                         Program name 
    D p_MsgDest       S              5                                         Destination  
    D p_MsgFile       S             10                                         Message file 
    D p_MsgKey        S              4                                         Message key  
    D p_MsgType       S              7                                         Message type 
                                                                                            
    D p_MsgID         DS             7                                         Message ID   
    D  MsgType                1      3                                          Message type
                                                                                            
    D p_MsgDta        DS           512                                         Message data 
    
    .......
    
    D D#SPQ           S             10                                         Message Queue name
    
    ......
    
    (main screen loop - basically, the message subfile is written before the EXFMT) :
    
    C                   ExSr      SetLegend                                      Cmd.Key legend
    C                   Write     D@FOOT                                         Footer        
    C                   Write     D@MSGCTL                                       Messages      
    C  N14              Write     D@NDT1                                         No Subfile    
    C                   Exfmt     D@SF1C                                         Detail screen 
    
    ......
    
    (when checking function keys after EXFMT) :
    
    C                   If        Fkey <> fnRollUp                             If not Roll Up  
    C                   ExSr      ClearMessage                                   Clear messages
    C                   EndIf                                                                  
    
    .......
    
    (Send message and clear message queue subroutines - call your own message sender) :
    
    C     SendMessage   BegSr                                                                  
                                                                                               
     * ========================================================================                
     * Send message to program message queue                                                   
     * ------------------------------------------------------------------------                
                                                                                               
    C                   If        MsgType = 'ERR'                              If error message
    C                   Eval      *In40   = *On                                  Set error flag
    C                   EndIf                                                                  
                                                                                               
    C                   Call      'TICSNMG'                                    <Send message>  
    C                   Parm      *Blank        p_MsgRtnCode                   B:Return code   
    C                   Parm      D#SPQ         p_MsgPgmName                   I:Program name  
    C                   Parm      '*SAME'       p_MsgDest                      I:Destination   
    C                   Parm                    p_MsgID                        I:Message ID    
    C                   Parm      'TTSMSGS'     p_MsgFile                      I:Message file  
    C                   Parm      *Blank        p_MsgKey                       I:Message key   
    C                   Parm                    p_MsgDta                       I:Message data  
    C                   Parm      '*INFO'       p_MsgType                      I:Message type
                                                                                             
    C                   Clear                   p_MsgID                        Message ID    
    C                   Clear                   p_MsgDta                       Message data  
                                                                                             
     * ------------------------------------------------------------------------              
     *                                                                                       
     * ========================================================================              
                                                                                             
    C                   EndSr                                                                
                                                                                             
    C     ClearMessage  BegSr                                                                
                                                                                             
     * ========================================================================              
     * Clear program message queue                                                           
     * ------------------------------------------------------------------------              
                                                                                             
    C                   Call      'TICSNMG'                                    <Send message>
    C                   Parm      *Blank        p_MsgRtnCode                   B:Return code 
    C                   Parm      D#SPQ         p_MsgPgmName                   I:Program name
    C                   Parm      '*SAME'       p_MsgDest                      I:Destination 
    C                   Parm      '*CLEAR'      p_MsgID                        I:Message ID  
    C                   Parm                    p_MsgFile                      I:Message file
    C                   Parm                    p_MsgKey                       I:Message key 
    C                   Parm                    p_MsgDta                       I:Message data
    C                   Parm                    p_MsgType                      I:Message type
                                                                                             
    C                   Clear                   p_MsgID                        ¦ Clear the   
    C                   Clear                   p_MsgDta                       ¦ parameters  
    C                   MoveA     *Off          *In(40)                        Reset errors  
                                                                                             
     * ------------------------------------------------------------------------              
     *                                                                                       
     * ========================================================================              
                                                                                             
    C                   EndSr                                                                
    
    This is just picked out of one program from many, all of which use the same standard code (yes, probably should be /COPY'd or proceduralised....) Sloopy
    2,195 pointsBadges:
    report
  • TomLiotta
    I put in another exfmt before I turned on the indicator... Just a comment for you to think about -- why did you use EXFMT instead of a simple WRITE? Tom
    125,585 pointsBadges:
    report
  • Kathan
    There r many ways to do that, 1) Use SFLCLR and clear that format. 2) Other way is bit diff, first use CLEAR opcode on that field and just after that use UPDATE on CTL. It will do.
    70 pointsBadges:
    report
  • SG29
    Hi, i am facing this problem: Acc. to my work assigned to me, I have to divide a display record into a Subfile and another display record. Earlier, *in20 was used on each field for DSPATR(PR). Now, when in my program *in20 is set on, no field in the subfile and the new display record is protected. also, on the Subfile Control format, no indicator like DSPATR(RI) on any field sets Reverse Image after being set to on.
    10 pointsBadges:
    report
  • TomLiotta
    Acc. to my work assigned to me, I have to divide a display record into a Subfile and another display record. It's not clear how this relates to this thread. Please open a new question so that your problem can get the attention it needs. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following