Search code examples
ibm-midrangerpgle

F10 function not returning control back to program


I have a display file where I have added two additional fields which come up on pressing f10 - fold/drop. when the user folds the records, the footer display should change to f10= unfold. When the display is unfolded, the display should change to f10 = fold.

         A***************************************************************
     A*  LIST OF LOADS WITH BOL SUBFILE CONTROL                      
     A***************************************************************
     A          R RLG610C1                  SFLCTL(RLG610S1)         
     A                                      SFLSIZ(0011)             
TPA01A                                      SFLPAG(0005)             
     A                                      OVERLAY                  
     A N71                                  SFLDSP                   
     A N71                                  SFLDSPCTL                
     A  71                                  SFLCLR                   
     A  91                                  SFLEND(*MORE)            
TPA01A N45                                  SFLDROP(CF10)            
TPA01A  45                                  SFLFOLD(CF10)            
TPA01A                                      SFLMODE(&MODE)           
     A            RRN            4S 0H      SFLRCDNBR                

The footer fields have been set as below:

TPA01A  45                             23 25'F10=Fold'    
TPA01A                                      COLOR(BLU)    
TPA01A N45                             23 25'F10=Unfold'  
TPA01A                                      COLOR(BLU)    

The issue is that when the user presses f10, the display changes as expected. But for the footer to change, an enter hit is required.

There is below piece of code that controls the display of fold/unfold options based on *IN45 indicator field value. But the control of program reaches here only when you hit enter, I would expect the control to return to the program on simply pressing f10

If Mode = '1';                
            *IN45 = '0';                
          ElseIf Mode = '0';            
            *IN45 = '1';                
          EndIf;    

Basically, Now I am wondering if the SFLFOLD and SFLDROP returns control to the program.

Desperately in help!

@charles,

I had already tried what you mentioned Charles. But it just aint working

     A          R RLG610C1                  SFLCTL(RLG610S1)      
     A                                      CF10(10 'FOLD/UNFOLD')
     A                                      SFLSIZ(0011)          
TPA01A                                      SFLPAG(0005)          
     A                                      OVERLAY               
     A N71                                  SFLDSP                
     A N71                                  SFLDSPCTL             
     A  71                                  SFLCLR                
     A  91                                  SFLEND(*MORE)         
TPA01A N45                                  SFLDROP(CF10)         
TPA01A  45                                  SFLFOLD(CF10)         

On pressing F10, the folding/unfolding works perfectly. But the control simply doesn't go to the program. I have even tried putting this at the file level. Even there it wasn't working. Any suggestions most welcome.


Solution

  • A 5250 device is a (relatively) smart device, not a dumb terminal.

    SFLFOLD and SFLDROP are processed on the device, so no control isn't returned to your program when F10 is pressed.

    Just have the footer contain

    F10=Fold/Unfold
    

    If you really want to have control returned to your program, configure F10 as a regular CF/CA key in the subfile control record. And use a dummy Fxx key in the SFLFOLD/SFLDROP keyword...

         A                                      CF10(10 'FOLD/UNFOLD')         
    TPA01A N45                                  SFLDROP(CF24)         
    TPA01A  45                                  SFLFOLD(CF24) 
    

    Thus, the control will return to your program. You'll have to check to see if F10 was pressed rather than checking mode, since the system isn't initiation the switch.