ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Add input error

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

  • Add input error

    I have a program RPGLE which conditonally invokes a function key.

    For instance:
    If Screen A is opened then this RPG will have a function key F15 and if Screen B is opened this rpg will check if indicator is on and accordingly hide the functionality of this key.
    I have been able to successfully implement this as well. But the issue now is the screen immediately exists out when this key F15 is hit from program B.

    I would like to have the program throw up "operator input error occurred- X II" error that usually appears for wrong input or at the least have the screen be at the same position but not exit out.

    The programs handles Enter key or any other key which has not been defined in program in a similar manner. i.e exists out of the screen. How to modify this to specifically handle the key under concern,F15

    Please guide.

  • #2
    Re: Add input error

    Would you try to explain this a bit better?
    Are you using the same display(DDS) in multiple programs?

    otherwise this is not an issue as function keys are defined in the DDS.

    thank you
    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Add input error

      Hi Jamie,

      Thanks for the response. Yep its the same DSPF thats being used and infact the same program too! An indicator has been set in the program that hides the functionality of F15 when called from screen B.You may be wondering what exactly is this screen A and B when the display and the program is the same. Well its a business functionality where the screen is in 2 different modes(not wanting to plunge deep here) but the only catch now is it exists the screen when this F15 is hit(F15 should not function when called from screen B. Same happens when a enter is hit but i'd anyway like to retain the "enter" functionality). I hope this explanation aids.

      Thanks

      Comment


      • #4
        Re: Add input error

        I might be even more confused this being the same program with just two screen formats...
        can't you just remove from screen B and be done with it?

        I picture this code with an if wrapped screenA & screenB with all the logic for function keys
        below...

        If it's the same program then you are just going to have to track it with indicators or variables.
        If it's multiple program calls then you will need to capture calling program and set on.off display
        function key..

        In DDS #REC will tell you which format the function key was pressed from:
        A RTNCSRLOC(&#REC &#FLD)

        This procedure tells you which program called:
        PHP Code:
         *                                             
         *  
        entry plist                                
         
        *                                             
        d CALLER          pr                           
        d  ProgramName                  10             
                                                       
        d CALLER          pi                           
        d  ProgramName                  10             
         
        *                                             
        d Qusec           ds                           
        d  QusBPrv                      10i 0          
        d  QusBAvl                      10i 0          
        d  Qusei                         7             
        d  Quserved                      1             
                                                       
         
        Type definition for the RCVM0200 format     
                                                                      
        d RCVM0200        DS           120                            
        d  Program              111    120                            
                                                                      
         
        *------------------------------------------                  
         * 
        Standalone Field Definitions                               
         
        *------------------------------------------                  
                                                                      
         * 
        Program message parameters                                 
                                                                      
        d Pm_MsgId        s              7    Inz
        (*BLANKS)            
        d Pm_MsgF         s             20    Inz(*BLANKS)            
        d Pm_MsgDta       s             12    Inz('Who are you?')     
        d Pm_Length       s             10i 0                         
        d Pm_MType        s             10    Inz
        ('*INFO')            
        d Pm_MKey         s              4    Inz(*BLANKS)            
        d Pm_CSEntry      s             10    Inz('*')                
        d Pm_Counter      s             10i 0 Inz(4)                  
                                                                      
        d Pm_Format       s              8    Inz('RCVM0200')         
        d Pm_Wait         s             10i 0 Inz(0)                      
        d Pm_Action       s             10    Inz('*REMOVE')              
                                                                          
         
        //                                                               
         //  external calls                                               
         //                                                               
                                                                          
        d $SndPgmMsg      pr                  extpgm('QMHSNDPM')          
        d   MessageID                    7A   Const                       
        d   QualMsgF                    20A   Const                       
        d   MsgData                     12A   Const                       
        d   MsgDtaLen                   10I 0 Const                       
        d   MsgType                     10A   Const                       
        d   CallStkEnt                  10A   Const                       
        d   CallStkCnt                  10I 0 Const                       
        d   MessageKey                   4A                               
        d   Qusec                       28    
        const                       
                                                                          
        d $RcvPgmMsg      pr                  extpgm('QMHRCVPM')          
        d RCVM0200                     120    const                       
        d Pm_Length                     10i 0 const                    
        d Pm_Format                      8    const                    
        d Pm_CSEntry                    10    const                    
        d Pm_Counter                    10i 0 const                    
        d Pm_MType                      10    const                    
        d Pm_MKey                        4    const                    
        d Pm_Wait                       10i 0 const                    
        d Pm_Action                     10    const                    
        d Qusec                         28    const                    
                                                                       
         /
        free                                                         
                                                                       
           
        //------------------------------------------                
           //          m a i n    l i n e                              
           //*------------------------------------------               
                                                                       
              // Set error code structure not to use exceptions        
                                                                       
                  
        QusBPrv 16;                                        
                                                                       
             
        // Set length of message data            
                                                      
                 
        Pm_Length 12;                      
                                                      
             
        // Send program message                  
                                                      
                 
        $SndPgmMsgPm_MsgId       :         
                             
        Pm_MsgF        :         
                             
        Pm_MsgDta      :         
                             
        Pm_Length      :         
                             
        Pm_MType       :         
                             
        Pm_CSEntry     :         
                             
        Pm_Counter     :         
                             
        Pm_MKey        :         
                             
        Qusec                    
                                        
        );            
                                                      
                                                      
                
        // Clear return data structure        
                                                      
                   
        clear RCVM0200;                       
                   
        Pm_Length 120;                      
                                                         
                                                         
              
        // receive the program message             
                                                         
                  
        $RcvPgmMsgRCVM0200       :           
                              
        Pm_Length      :           
                              
        Pm_Format      :           
                              
        Pm_CSEntry     :           
                              
        Pm_Counter     :           
                              
        Pm_MType       :           
                              
        Pm_MKey        :           
                              
        Pm_Wait        :           
                              
        Pm_Action      :           
                              
        Qusec                      
                                             
        );          
                                                         
                                                         
                  
        // Check for errors                    
                                                 
                  
        if  QusBAvl 0;               
                   
        clear programname;            
                  else;                          
                   
        programname Program;        
                  endif;                         
                                                 
                       
                                                 
                  return;                        
         /
        end-free 
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Add input error

          Thanks Jamie.The issue has been fixed. Appreciate the help.

          Comment


          • #6
            Re: Add input error

            Please share your solution...
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: Add input error

              I would be curious to know why he has F15 active on both screens when the only screen that required it was Screen A. I suspect F15 was set at the file level and not the record format level.

              Comment


              • #8
                Re: Add input error

                Young man...I'm not even sure I understand the problem..
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment

                Working...
                X