ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to display Output Field after ERRMSG

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

  • How to display Output Field after ERRMSG

    Hi,
    just a silly question... I have a display file showing:

    1) Order Number (Input field)
    2) Customer Code (Output Field)
    3) Customer Name (Output Field)
    4) Operator Code (Input field)

    On field 1 I have indicator 50 with errmsg keyword if invalid order is keyed.
    On field 4 I have indicator 51 with errmsg keyword if invalid Operator is keyed.

    If no error is found on field 1 I want Field 2 and 3 populated and shown on display EVEN IF an error occurs on filed 4.
    BUT if an error occurs in filed 4 fields 2 and 3 are not shown, but in debug mode I can see my RPG program populating them correctly.

    I've found out that I can do a WRITE operation setting off all error indicators, then setting them back on and than perform an EXFMT. This works but looks "dirty".

    Is there a keyword in dds to say the display to show ALL th output fields with their actual value whatever error indicator is set on ??

    Thanks a lot....

  • #2
    Re: How to display Output Field after ERRMSG

    Please paste here the DDS of the display file.
    Philippe

    Comment


    • #3
      Re: How to display Output Field after ERRMSG

      Here's the source.
      The compilation options are:
      PHP Code:
      RSTDSP(*YES
      DFRWRT(*NO
      DECFMT(*JOB)

      ---- 
      SOURCE -----

      A                                      DSPSIZ(24 80 *DS3)                  
      A                                      CHGINPDFT(HI CS)                    
      A                                      ERRSFL                              
      A                                      
      PRINT                               
      A N60                                  CA03                                
      A N60                                  CF06                                
      A          R TESTA                                                         
      A            D1SOCD        15A  O  1  3                                    
      A                                  1 23
      'Copia Contratto per diverso Client-
      A                                      e'                                  
      A                                      DSPATR(HI)                          
      A                                  1 69DATE                                
      A                                      EDTCDE
      (Y)                           
      A                                  2 69USER                                
      A          R VIDEO1                                                        
      A                                      OVERLAY                          
      A                                      PUTOVR                           
      A                                      OVRDTA                           
      A                                      OVRATR                           
      A                                      FRCDTA                           
      A                                  5  2
      'Numero Contr. da Copiare ...:'  
      A                                  7  2'Cliente Originale ..........:'  
      A                                  9  2'Cliente su cui copiare .....:'  
      A            D1CTROR        9Y 0B  5 32CHECK(RZ)                        
      A                                      EDTCDE(4)                        
      A  50                                  DSPATR(PC)                       
      A  50                                  DSPATR(RI)                       
      A  50                                  ERRMSG('Contratto non valido' 50)
      A  60                                  DSPATR(PR)                       
      A            D1CLIO         8   O  7 32                                 
      A                                  7 41
      '/'                              
      A            D1FILO         3A  O  7 43                                 
      A            D1CLIOD       30A  O  8 32                                 
      A            D1CLIN         8A  B  9 32                                  
      A  51                                  DSPATR
      (PC)                        
      A  51                                  DSPATR(RI)                        
      A  51                                  ERRMSG('Cliente non esistente' 51)
      A  60                                  DSPATR(PR)                        
      A                                  9 41'/'                               
      A            D1FILN         3Y 0B  9 43DSPATR(HI)                        
      A                                      DSPATR(CS)                        
      A                                      EDTCDE(4)                         
      A  51                                  DSPATR(PC)                        
      A  51                                  DSPATR(RI)                        
      A  51                                  ERRMSG('Cliente non esistente' 51)
      A  60                                  DSPATR(PR)                        
      A            D1CLIND       30A  O 10 32                                  
      A          R PIEDE                                                       
      A                                      OVERLAY                           
      A  60                             13  2
      'Contratto Nuovo Generato ...:'   
      A            D1CTRNW        9Y 0O 13 32DSPATR(HI)                        
      A                                      EDTCDE(4)                         
      A  60                                  DSPATR(ND)                        
      A  60                             13 42'Premere INVIO per Proseguire:'
      A                                 22  2'F3=Fine'                      
      A  60                                  DSPATR(ND)                     
      A                                 22 12'F6=Elabora'                   
      A  60                                  DSPATR(ND

      Comment


      • #4
        Re: How to display Output Field after ERRMSG

        Hi,
        Your RPG program will populate the fields as it is expected to.

        However, since you have ND against fields on your DSPF (based on indicators), those fields should not be DISPLAYED if the specified conditions are satisfied.

        Is this what your problem is?
        â??No bird soars too high if he soars with his own wingsâ?? â?? William Blake

        Comment


        • #5
          Re: How to display Output Field after ERRMSG

          I don't see anything wrong in the display file DDS and I can see that the response indicator is correctly set up on the ERRMSG kwd. Personally I don't use ERRMSG/ERRMSGID anymore, instead I use a message subfile to send messages to the users so I can send informational and error messages as well.

          Look into the logic of the program as it should display the output fields. However if you cannot spot the flaw, feel free to paste here the relevant part of your RPG so that we can help to find what or where it doesn't work.
          Philippe

          Comment


          • #6
            Re: How to display Output Field after ERRMSG

            Just a few comments:

            You use
            Code:
            [SIZE=2][FONT=Courier New][COLOR=#0000bb]A  51                                  DSPATR[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]PC)[/COLOR][/FONT][/SIZE]
            [SIZE=3][FONT=Courier New][SIZE=2][COLOR=#0000bb]A  51                                  DSPATR[/COLOR][COLOR=#007700]([/COLOR][/SIZE][COLOR=#0000bb][SIZE=2]RI)[/SIZE] [/COLOR][/FONT][/SIZE]
            Why the RI if there's an error? IMO, not needed.
            Why the PC if there's an error? I assume this means you validate and stop validating and display an error message immediately. Repeat 100x for 100 errors... ugggh. I prefer to use the ERRSFL and let the system handle the SFL error messages but give the user all the INFORMATION required to complete the task as accurately and as quickly as possible.
            Regards

            Kit
            http://www.ecofitonline.com
            DeskfIT - ChangefIT - XrefIT
            ___________________________________
            There are only 3 kinds of people -
            Those that can count and those that can't.

            Comment


            • #7
              Re: How to display Output Field after ERRMSG

              These indicators are useless here but do not prevent the output fields to correctly display. IMO she has to look anyway into the logic of her program.
              Philippe

              Comment


              • #8
                Re: How to display Output Field after ERRMSG

                The logic is very simple:
                I check the values for all the fileds and I set to on all the indicators. I mean if 3 fileds are wrong I set to on 3 indicators and I show 3 messages (I use the keyword ERRSFL) than I show the display where I want ALL the wrong fields being Reverse image (you're right that PC display attribute is not needed).

                I copy here some pieces of my RPG using an attachment (more readeable I guess)

                Do you see anything wrong ???
                Attached Files

                Comment

                Working...
                X