RPG/400 – Window Subfile

75 pts.
Tags:
RPG
RPG/400
Subfile
I want to display a footer on a window subfile. I have used a window subfile which displays a list of codes. And want to have a footer on this window. For this I used a simple WINDOW having the same border formats and position as that of the Window subfile - this contains just one line at the bottom 'F12 - Cancel'. Used OVERLAY in both the Wsubfile as well as Window. In the RPG program, I use a WRITE of Window footer followed by a EXFMT of window subfile CTL. However, it shows the Window footer, and then replaces it with the Window Subfile i.e OVERLAY does not happen and cannot see the footer. Is there any other parameters to be set for displaying the Windows? Does it not work like normal subfiles?
ASKED: May 30, 2008  6:30 AM
UPDATED: June 4, 2008  9:08 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

The Window reserves a line at the bottom for a system message line. This may be overlaying the footer of the other window. Try making your subfile window one or two lines bigger than the window underneath.
——–
Try using the WDWTITLE (window title) keyword – this will allow you to put the text you desire in the window frame, either at the top or the bottom – your choice.

——–

Nope this does not work!
Can be solved by using the Window footer as a reference in the Window subfile.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Sloopy
    The bare bones of the DDS and code needed to display a subfile window with footer is quite simple, but not particularly intuitive. I'll only show the relevant keywords here; there are of course subfile keywords, cursor and rrn fields etc. which are not shown. In the DSPF DDS, you need a subfile record format, a subfile control format, a footer format, a 'no data' format, a window format and a dummy format. The DSPF must be created with DFRWRT(*YES) (the default) and RSTDSP(*YES). Subfile record format (no special keywords):
    A          R D@SF1                      SFL
    
    Subfile control format (will contain a window title field) :
    A          R D@SF1C                     TEXT('Screen heading/selection')
    A                                       WINDOW(D@WIN)                   
    A                                       OVERLAY
    
    A            D£TITL        31      1  1
    
    Footer:
    A          R D@FOOT                     TEXT('Footer')
    A                                       WINDOW(D@WIN) 
    A                                       OVERLAY       
    
    A            ##FOOT        31     14  1
    
    Window format (complete). The ##PROW and ##PCOL fields contain the top-left row and column positions for the window, and are set by your program. This allows you to move the window around the screen :
    A          R D@WIN                      TEXT('Overlaying window')        
    A                                       RMVWDW                           
    A                                       OVERLAY                          
    A                                       WINDOW(&##PROW &##PCOL 014 31  + 
    A                                                            *NOMSGLIN + 
    A                                                            *NORSTCSR  )
    A            ##PROW         3S 0P                                        
    A            ##PCOL         3S 0P                                        
    
    'No Data' format, written if the subfile is empty. The blank is written to a position which would be occupied by the subfile data:
    A          R D@NODATA                   TEXT('No data in subfile')
    A                                       WINDOW(D@WIN)             
    A                                       OVERLAY                   
    A                                  8  2' '                        
    
    'Dummy' format, which sets up options in the workstation controller that make the window behave cleanly when the window program is called from another screen program. The blank is written to an unused part of the screen. Since there is no message line in this window, the unused line will be line 24. Indicator 01 is NOT set on. :
    A          R D@DUMMY                    TEXT('Dummy format')
    A                                       KEEP ASSUME OVERLAY 
    A  01                             24  2' '                  
    
    Now the RPG code to use the window: File spec (I use the information data structure, you don't have to) :
    FTGW003D   CF   E             WorkStn InfDS ( ScreenInfDS  )
    F                                     Sfile ( D@SF1:D1DRRN )
    F                                     UsrOpn                
    
    In mainline (or screen loop subroutine) :
    C                   Write     D@WIN         (done only once)
    C                   ExSr      LoadScreen    
                                                
    C                   DoU       Fkey = fnExit 
                                                
    C                   Write     D@FOOT        
    C  N14              Write     D@NODATA      
    C                   ExFmt     D@SF1C        
    
    (your own code here, etc.)
    
    C                   EndDo                
    
    Before you exit the program :
    C                   Write     D@DUMMY    
    C                   Close (E) TGW003D    
    C                   Eval      *InLR = *On
    C                   Return 
    
    In Initialisation (close first in case previous call in error) :
    C                   Close (E) TGW003D    
    C                   Open  (E) TGW003D    
    
    If you change the window position by changing the values in ##PROW / ##PCOL, you need to WRITE D@WIN again. Regards, Sloopy
    2,195 pointsBadges:
    report
  • Sloopy
    I hate this text editor. It seems to ignore the 'code' function, and assumes an email address when I use an 'at' symbol.... Please ignore my previous entry, and hope this new attempt is at least readable.... The bare bones of the DDS and code needed to display a subfile window with footer is quite simple, but not particularly intuitive. I'll only show the relevant keywords here; there are of course subfile keywords, cursor and rrn fields etc. which are not shown. In the DSPF DDS, you need a subfile record format, a subfile control format, a footer format, a 'no data' format, a window format and a dummy format. The DSPF must be created with DFRWRT(*YES) (the default) and RSTDSP(*YES). Subfile record format (no special keywords):
    A          R D#SF1                      SFL
    
    Subfile control format (will contain a window title field) :
    A          R D#SF1C                     TEXT('Screen heading/selection')
    A                                       WINDOW(D#WIN)                   
    A                                       OVERLAY
    
    A            D£TITL        31      1  1
    
    Footer:
    A          R D#FOOT                     TEXT('Footer')
    A                                       WINDOW(D#WIN) 
    A                                       OVERLAY       
    
    A            ##FOOT        31     14  1
    
    Window format (complete). The ##PROW and ##PCOL fields contain the top-left row and column positions for the window, and are set by your program. This allows you to move the window around the screen :
    A          R D#WIN                      TEXT('Overlaying window')        
    A                                       RMVWDW                           
    A                                       OVERLAY                          
    A                                       WINDOW(&##PROW &##PCOL 014 31  + 
    A                                                            *NOMSGLIN + 
    A                                                            *NORSTCSR  )
    A            ##PROW         3S 0P                                        
    A            ##PCOL         3S 0P                                        
    
    'No Data' format, written if the subfile is empty. The blank is written to a position which would be occupied by the subfile data:
    A          R D#NODATA                   TEXT('No data in subfile')
    A                                       WINDOW(D#WIN)             
    A                                       OVERLAY                   
    A                                  8  2' '                     
    
    'Dummy' format, which sets up options in the workstation controller that make the window behave cleanly when the window program is called from another screen program. The blank is written to an unused part of the screen. Since there is no message line in this window, the unused line will be line 24. Indicator 01 is NOT set on. :
    A          R D#DUMMY                    TEXT('Dummy format')
    A                                       KEEP ASSUME OVERLAY 
    A  01                             24  2' '                  
    
    Now the RPG code to use the window: File spec (I use the information data structure, you don't have to) :
    FTGW003D   CF   E             WorkStn InfDS ( ScreenInfDS  )
    F                                     Sfile ( D#SF1:D1DRRN )
    F                                     UsrOpn                
    
    In mainline (or screen loop subroutine) :
    C                   Write     D#WIN         (done only once)
    C                   ExSr      LoadScreen    
                                                
    C                   DoU       Fkey = fnExit 
                                                
    C                   Write     D#FOOT        
    C  N14              Write     D#NODATA      
    C                   ExFmt     D#SF1C        
    
    (your own code here, etc.)
    
    C                   EndDo                
    
    Before you exit the program :
    C                   Write     D#DUMMY    
    C                   Close (E) TGW003D    
    C                   Eval      *InLR = *On
    C                   Return 
    
    In Initialisation (close first in case previous call in error) :
    C                   Close (E) TGW003D    
    C                   Open  (E) TGW003D    
    
    If you change the window position by changing the values in ##PROW / ##PCOL, you need to WRITE D#WIN again. I hope this is a help; Sloopy
    2,195 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following