Search code examples
ibm-midrangerpgle

AS400 - case with DDS (PROTECT vs WINDOW keyword)


I have a problem with using WINDOW keyword together with PROTECT keyword. I want to block all fields on SCR01DS. For this purpose I create record named PROTECT (with PROTECT keyword inside).

There is everything fine without WINDOW keyword on DDS. But in this way record is shown "full screen". But what if I wanted to show record SCR01DS on the selected part of screen? For this purpose I have to uncomment WINDOW keyword.

But after performing this operation there is something wrong and record SCR01DS is not shown at all.

Can anyone help me, how to use WINDOW keyword together with PROTECT keword?

A* TEST01DF  DSPLF                                         
A                                      CF03(03 'END')      
A          R SCR01DS                                       
A*                                     WINDOW(8 10 15 35)  
A                                  2 21'TEST'              
A                                      DSPATR(RI)          
A            CHECKNUM       2Y 0B  4  2MLTCHCFLD           
A                                      CHOICE(1 'Mushroom')
A                                      CHCCTL(1 &TEST1_)   
A            TEST1_         1Y 0H                          
A          R PROTECT                                       
A                                      OVERLAY             
A                                      PROTECT             

F* TEST01 RPGLE                                   
Ftest01df  CF   E             workstn  prefix(w_) 
 /free                                            
  *inlr = *on;                                    
  w_test1_ = 1;                                   
  dou *in03=*on;                                  
    write scr01ds;                                
    exfmt protect;                                
   enddo;                                         
 /end-free                                        

Solution

  • Your PROTECT record is not a 'windowed' record. It's a full-screen record.

    Add the WINDOW() keyword to the record:

     A          R PROTECT                                  
     A                                      WINDOW(SCR01DS)
     A                                      OVERLAY        
     A                                      PROTECT   
    

    That should give you what you seem to want.