Page 1 of 1

Not getting keystroke values from ISPF popup panel

PostPosted: Sat Jun 16, 2018 2:29 pm
by nikesh_rai
Hi Friends,

I am trying to write a ISPF popup panel to display messages. And when I will press PF3 or ENTER key, popup screen should be closed and control should return back to the main panel.
However, during debug I saw that popup panel is not identifying or capturing keystrokes for PF3 and ENTER. Could you please help me for this issue.

part of REXX code:


ARG R,DISDATE,DISTIME,KEY,RES,A,PDS,KEY1    

DO UNTIL INVLD_OP = 0
  INVLD_OP = 0

  IF  (KEY = PF03) THEN
  DO
    EXIT
  END

  SELECT
   WHEN R = '1' THEN
        DO
          ADDRESS ISPEXEC
          "DISPLAY PANEL(FLUPLDPN)"
          "SETMSG MSG(ISRZ001)"
        END
   WHEN R = '2' THEN
       DO
         ADDRESS ISPEXEC
         "DISPLAY PANEL(CPYILAPN)"
         "SETMSG MSG(ISRZ001)"

         IF (KEY = PF03) THEN
         DO
           EXIT
         END
         ELSE
         DO
           CALL VLD_CPY_DATA
           CALL RTRV_GIB_ILA
         END
       END

   OTHERWISE
       DO
         KEY1 = '   '
         RES =  '   '
         MSG01 = 'PLEASE ENTER CORRECT OPTION'
         "ADDPOP ROW(5) COLUMN(10)"
         "DISPLAY PANEL(MSG001)"
         "REMPOP"
         INVLD_OP = 1
         SAY KEY1
         SAY RES
         IF RES = ENTER THEN
         DO
           "DISPLAY PANEL(MSTRPNL1)"
           "SETMSG MSG(ISRZ001)"
         END
         ELSE
         DO
           EXIT
         END
       END
  END
END


popup ISPF panel

)ATTR                                      
$ TYPE(OUTPUT) INTENS(HIGH) COLOR(GREEN)    
~ TYPE(INPUT) INTENS(HIGH) COLOR(GREEN)    
)BODY WINDOW(35,2)                          
$MSG01                                      
)END                                        
)PROC                                      
&KEY1 = .PFKEY                              
&RES = .RESP                                
)END                  



debug screen

     93 *-*    OTHERWISE                                
     94 *-*     DO                                      
     95 *-*      KEY1 = '   '                            
        >L>        "   "                                
     96 *-*      RES =  '   '                            
        >L>        "   "                                
     97 *-*      MSG01 = 'PLEASE ENTER CORRECT OPTION'  
        >L>        "PLEASE ENTER CORRECT OPTION"        
     98 *-*      "ADDPOP ROW(5) COLUMN(10)"              
        >L>        "ADDPOP ROW(5) COLUMN(10)"            
     99 *-*      "DISPLAY PANEL(MSG001)"                
        >L>        "DISPLAY PANEL(MSG001)"              
 ***                                                    
                                                         
    100 *-*      "REMPOP"        
        >L>        "REMPOP"      
    101 *-*      INVLD_OP = 1    
        >L>        "1"            
    102 *-*      SAY KEY1        
        >V>        "   "          
                                 
    103 *-*      SAY RES          
        >V>        "   "          
                                 
    104 *-*      IF RES = ENTER  
        >V>        "   "          
        >L>        "ENTER"        
        >O>        "0"            
    109 *-*      ELSE            
    110 *-*       DO              
    111 *-*        EXIT          
 ***                                    

Re: Not getting keystroke values from ISPF popup panel

PostPosted: Sat Jun 16, 2018 8:00 pm
by willy jensen
remove the )END statement in line 6

Re: Not getting keystroke values from ISPF popup panel

PostPosted: Sat Jun 16, 2018 8:20 pm
by nikesh_rai
Thanks Willy, code is working fine now after removing )END. :)

Re: Not getting keystroke values from ISPF popup panel

PostPosted: Mon Jun 18, 2018 9:47 pm
by Pedro
I do not think you should check which PF key was pressed because the user can redefine their keys to be something else.

I think the preferred approach is to check the return code for the DISPLAY service for 0 or 8.

Re: Not getting keystroke values from ISPF popup panel

PostPosted: Wed Jun 20, 2018 1:10 pm
by nikesh_rai
Thanks Pedro,

I will try this option as well and will let you know. Thanks for this suggestion. :)