Friday, December 6, 2013

Day-15.

Report Layout Utility:

 Overview:
This module enables the student to understand the concept of RLU.
 Outline:
Topics covered,

  • Design a printer file
  • Simple RPG program
Objective:
By the end of this module, the student should be able to write program related to:
·  Work with RLU including RPG program
Report Layout Utility (RLU)
What is RLU?
In the early days of RPG, reports were always printed using OUTPUT specifications. With the advent of DDS, it became possible to make print files using DDS. This is similar to the way DDS is used to make display files. The AS/400 provides SDA, Screen Design Aid, as an on-line tool to design display files. Similarly, RLU, is an on-line tool to design reports.
Suppose a user needs a report showing:
  1. Roll Number
  2. Name
  3. Address
  4. Course Name
  5. Marks
These fields are in the STUDENT file. We will write an RPG program, to read the STUD file and write a print file. To work with printer file use option 19 just like as we use 17 option for screen.

Steps to design with RLU.
Create a physical file STUD1 in PB01U01O as given below-

Columns . . . :    1  71            Edit                            PB01U01D/MYPDDS
 SEU==>                                                                   STUD1
 FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
        *************** Beginning of data *************************************
0001.00                                              UNIQUE                     
0002.00      A          R RSTUD                                                 
0003.00      A              ROLL           3S 0       COLHDG('ROLL NUMBER')      
0004.00      A              SNAME       5A         COLHDG('STUDENT NAME')     
0006.00      A              CORS          5A         COLHDG('COURSE NAME')      
0007.00      A              ADD            5A         COLHDG('ADDRESS')          
0005.00      A              MARKS      3S 0       COLHDG('MARKS')      
0008.00      A          K ROLL                                                 
        ****************** End of data ****************************************
                                                                                               
 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle      
 F16=Repeat find       F17=Repeat change          F24=More keys                
                                         (C) COPYRIGHT IBM CORP. 1981, 2002.   

To create RLU

·   To start RLU, enter the command STRRLU on command line and hit F4 to get this screen.

                                             Start Report Layout Utility (STRRLU)                     
                                                                                 
 Type choices, press Enter.                                                     
                                                                               
Source file  . . . . . . . . . .   *PRV            Name, *PRV                   
Library  . . . . . . . . . . .                 Name, *LIBL, *CURLIB, *PRV   
Source member  . . . . . . . . .   *PRV          Name, *PRV                   
Option . . . . . . . . . . . . .   2             2, 6                         
Page width . . . . . . . . . . .   *SAME         1-378, *SAME                  
Text 'description' . . . . . . .   *BLANK                                     
                                                                                                                                                              
                                                                               
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display   
 F24=More keys                                                                 
                                                                               
·         Enter MYPRTF as the source file.
·         Enter the library name ‘PB01U01D’ and ‘PRTF1’ as the source member.
  
                                            Start Report Layout Utility (STRRLU)                     
                                                                               
 Type choices, press Enter.                                                     
                                                                               
Source file  . . . . . . . . . . > MYPRTF          Name, *PRV                   
Library  . . . . . . . . . . . >   PB01U01D       Name, *LIBL, *CURLIB, *PRV   
Source member  . . . . . . . . .   PRTF1         Name, *PRV                   
Option . . . . . . . . . . . . .   2             2, 6                         
Page width . . . . . . . . . . .   62         1-378, *SAME                  
Text 'description' . . . . . . .   *BLANK                                     
                                                                                                                                                          
                                                                               
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display   
 F24=More keys                                                                 
                                                                               
·    Since this is a narrow report, enter 65 for the page width. For a standard width  report, you would use 132 for the page width.
·    Hit Enter RLU now displays its DESIGN REPORT screen.

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
'''''''                                                                         
'''''''                                                                        
'''''''                                                                        
'''''''                                                                         
'''''''                                                                        
'''''''                                                                        
'''''''                                                                                                                                                  
        --------------------------- End of Report -----------------------------
                                                                                
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
Member PRTF1 added to file PB01U01D/MYPRTF.                                        +

·   RLU uses so many function keys that there is a base set of function keys and an alternate set of keys. F22 is used to toggle between the base keys and the alternate keys.
·   The simplest way to use RLU is to define each line as a separate record.
·   To start working with a line of the report, key DR for DEFINE RECORD in the command area on a blank line. When you hit the enter key, RLU names the record with the default name RCD001.

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
DR'''''                                                                        
'''''''                                                                        
'''''''                                                                         
'''''''                                                                        
'''''''                                                                        
'''''''                                                                         
'''''''                                                                                                                        
        --------------------------- End of Report -----------------------------
                                                                               
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                     
Member PRTF1 added to file PB01U01D/MYPRTF.                                        +

·         When you hit the enter key, RLU names the record with the default name RCD001 as shown below.
Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
 RCD001                                                                        
        --------------------------- End of Report -----------------------------
                                                                                
                                                                              
                                                                               
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                     
                                                                                
·    After defining a record, enter VF for VIEW FIELDS in the command area of the same line. RLU then adds a line above the record to show the field information.

                                                    Work with Record Keywords                           
                                                                               
 Record format  . . . . :   HEADER                                              
                                                                               
 Type options, press Enter.                                                    
   2=Specify   4=Remove                                                        
                                                                                
 Opt     Keyword            Opt     Keyword            Opt     Keyword         
            CDEFNT                        SKIPA                                      
            CHRSIZ                          SKIPB                                      
            CPI                       2         SPACEA                                     
            DFNCHR                        SPACEB                                     
            DRAWER                        TEXT                                       
            FNTCHRSET                                                             
            FONT                                                                  
            HIGHLIGHT                                                              
            INDTXT                                                                
            LPI                                                                   
            PAGRTT                                                                 
            PRTQLTY                                                               
                                                                         Bottom
 F3=Exit      F5=Refresh   F9=Input keyword parameters   F10=Rename record     
 F12=Cancel   F16=Remove all keywords                                          
 
·         This option ‘SPACEA’ provides 2 spaces after record format name. Press enter

                                                               Specify Space After                              
                                                                               
 Keyword  . . . . . . . . . . . . . . :   SPACEA                               
 Record format  . . . . . . . . . . . :   HEADER                               
 Number of indicators . . . . . . . . :   0                                    
                                                                               
                                                                               
 Type choices, press Enter.                                                    
                                                                               
   Number of lines to space after                                              
     printing . . . . . . . . . . . . .     1          0-255                  
                                                                               
   Option indicators  . . . . . . . . .                 01-99, N01-N99         
                                                                                
     More indicators  . . . . . . . . .     N           Y=Yes, N=No            
                                                                                                                                                         
                                                                               
 F3=Exit   F5=Refresh   F12=Cancel   F16=Remove keyword                        
                                                                                
·   Press enter which gives you above screen again, then press ‘F10’ to rename the record format as shown below

                                                          Rename Record Format                              
                                                                               
 Number of keywords . . . . . . . . . :   1                                    
                                                                               
 Type choice, press Enter.                                                     
                                                                               
   Record format  . . . . . . . . . . .   HEADER1       Name                    
                                                                                
                                                                                                                         
                                                                               
 F3=Exit   F5=Refresh   F12=Cancel                                             
                                                                               

·         Enter until following screen is not come on display 
Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
 HEADER1                                                                         
00002 +                                                                        
00003 +                                                                        
        --------------------------- End of Report -----------------------------
                                                                              
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
                                                                                
·    Finally, center the heading by keying CF for CENTER FIELD on the command portion of the RCD001 line. When you hit ENTER, the heading will center.
·    Now, create a second record. This will be used to print the fields. First insert a line to work with. Key I for INSERT in the command area of the RCD001 line and hit ENTER. Then, as before, key DR to define this as a record and then VF for VIEW FIELDS as shown below.

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
 HEADER                                                                        
VF002 +                                                                        
00003 +                                                                         
        --------------------------- End of Report -----------------------------
                                                                                                                                                  
                                                                               
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                     

Press enter    

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
 HEADER                                                                        
FLD1                                                                            
00002 +                                                                        
00003 +                                                                        
        --------------------------- End of Report -----------------------------
                                                                                                                                                       
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
                                                                               
·         Write column headings here as shown below

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                        
FLD1                      'Student Details'                                    
00002 +                                                                         

     
                                                                               
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
                                                                               
·   Now hit enter
·   Create one more record format having name ‘HEADER’ as discussed above. Keep SpaceA = 2 and write headings as shown below.

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                        
FLD1                       <.............>                                     
00002 +                    Student Details                                     
HEADER                                                                        
FLD1     ‘RollNo’     'Name'    'Address'  'Course Name'    ‘Marks'         
00002 +                                                                  
00003 +                                                                        
                                                                       

        --------------------------- End of Report -----------------------------
                                                                                                                                     
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
                                                                               
 ·  Press enter
 ·  Now Insert one more record format as discussed above having name ‘DETAILS’ for          that insert one line using ‘I’ & write ‘DR’ as shown below
  
Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                         
FLD1                       <.............>                                     
00002 +                    Student Details                                     
 HEADER                                                                         
FLD1       <....>     <..>      <.....>    <.........>    <.........>          
00004 +    RollNo     Name      Address    Course Name      Marks          
00005 +                                                                         
 RCD001
        --------------------------- End of Report -----------------------------
                                                                               
                                                                                                                                                    
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
                                                                               
                                                                                
 · Now rename RCD001 as DETAILS using keys shift F6(F18) + F10 and specify    
   SpaceA=2.

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                         
FLD1                       <.............>                                     
00002 +                    Student Details                                     
 HEADER                                                                         
FLD1       <....>     <..>      <.....>    <.........>    <.........>          
00004 +    RollNo     Name      Address    Course Name      Marks          
00005 +                                                                         
DETAILS                                                                        
00005 +                                                                        
00006 +                                                                        
        --------------------------- End of Report -----------------------------
                                                                                                                                                  
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
                                                                               

·   Next, use RLU to retrieve the field definitions from the master file. Hit F10 for DATABASE FIELDS.

                                                       Work with Database Fields                           
                                                                               
 Type options, press Enter.                                                    
   1=Add field   4=Remove   8=Display field description                        
                                                                               
 Option     Field          Library        File           Record                
                                                                                
                                                                               
   (No database fields selected)                                               
                                                                                
                                                                                                                    
                                                                               
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F16=Delete all fields         
                                                                               
·  Key 1 for the option to ADD FIELD. Leave the FIELD value blank. Enter the library  name and STUD1 for the File. Enter the record name of the RSTUD file.
·  RLU will then retrieve all the fields in the STUD1 file and list them. Select the fields for the report. For selecting fields put curser on FIELD and press ‘F4’ to get the following screen.

                                                            Add Database Fields                              
                                                                               
 Type choices, press Enter.                                                    
                                                                                
File . . . . . . . . . . .   STUD1                 Name, F4 for list              
Library  . . . . . . . .     PB01U01D        Name, *LIBL, *CURLIB           
Record format  . . . . . .   RSTUD         Name, F4 for list              
Field  . . . . . . . . . .                               Name, F4 for list              
                                                                               
                                                                                 
                                                                               
 F4=Prompt   F5=Refresh   F12=Cancel                                           
                                                                               
·    Again put curser on here(fields) and press F4 and for  inserting the first field in the report, key 1 in the text area of the FLD record above the detail record line. When you hit ENTER, RLU puts that field in the layout. RLU has re-sequenced the remaining fields. Place the remaining fields in the report  Select Database Fields     
                     

                                                                               
 File . . . . . . . . :   STUD1           Record . . . . . . . :   RSTUD       
 Library  . . . . . :     PB01U01D                                              
                                                                                
 Position to  . . . . .                Field                                   
 Subset . . . . . . . .   *ALL         *ALL, name, *generic*                   
                                                                                
 Type options, press Enter.                                                    
   1=Select   8=Display field description                                      
                                                                                
                                                          Column               
 Opt     Field       Length  Type                            Heading              
  1       ADD             5    Character                     ADDRESS              
  1       MARKS       3,0  Zoned decimal             COURSE CODE          
  1       CORS          5     Character                     COURSE NAME          
  1       ROLL           3,0  Zoned decimal              ROLL NUMBER          
  1       SNAME       5     Character                     STUDENT NAME         
                                                                                                       
                                                                         Bottom
 F5=Refresh   F11=Display unsorted   F12=Cancel                                
                                                                                
·  Hit ENTER until you return to the DESIGN REPORT screen enter until this screen comes.

                                                       Work with Database Fields                           
                                                                                
 Type options, press Enter.                                                    
   1=Add field   4=Remove   8=Display field description                        
                                                                                
 Option     Field          Library               File            Record                
                                                                               
                ADD          PB01U01D       STUD        RSTUD                 
                MARKS    PB01U01D       STUD        RSTUD                 
                CORS       PB01U01D       STUD        RSTUD                 
                ROLL       PB01U01D       STUD        RSTUD                 
                SNAME   PB01U01D       STUD        RSTUD                 
                                                                                                             
                                                                               
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F16=Delete all fields         
                                                                                
·  The names of the fields you selected are at the bottom of the screen. Each field is sequentially numbered.

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                        
FLD1                       <.............>                                     
00002 +                    Student Details                                     
 HEADER                                                                         
FLD1       <....>     <..>      <.....>    <.........>    <.........>          
00004 +    RollNo     Name      Address    Course Name      Marks          
00005 +                                                                         
DETAILS                                                                        
00005 +                                                                        
00006 +                                                                         
        --------------------------- End of Report -----------------------------
                                                                                                                                                     
                                                                               
 1:ADD   2:MARKS   3:CORS   4:ROLL   5:SNAME                                     
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
                                                                                                                                                            
If you want to remove a field, put the cursor on the field and hit F16(shift + F4).
If you need to move a field, use F13 to mark where the cursor is positioned and then F15 to move the field to a new location.

Now add this field as shown below using ‘VF’ option and put fields from database on screen as shown below

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
 HEADER1                                                                        
FLD1                       <.............>                                     
00002 +                    Student Details                                      
 HEADER                                                                        
FLD1       <....>     <..>      <.....>    <.........>    <.........>          
00004 +    RollNo     Name      Address    Course Name      Marks          
00005 +                                                                        
DETAILS                                                                        
FLD1       &4         &5        &1         &3             &2                   
00005 +                                                                         
00006 +                                                                        
        --------------------------- End of Report -----------------------------
                                                                                                                                                    
                                                                                
 1:ADD   2:MARKS   3:CORS   4:ROLL   5:SNAME                                     
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                     
                                                                               
Hit enter to get following output,

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                         
FLD1                       <.............>                                     
00002 +                    Student Details                                     
 HEADER                                                                         
FLD1       <....>     <..>      <.....>    <.........>    <.........>          
00004 +    RollNo     Name      Address    Course Name      Marks          
00005 +                                                                        
DETAILS                                                                        
FLD1       <.>        <...>     <...>      <...>           <.>                  
00005 +    999        XXXXX     XXXXX      XXXXX          999                  
00006 +                                                                         
        --------------------------- End of Report -----------------------------
                                                                             
                                                                                
 F3=Exit   F11=Define field   F16=Delete field                                 
 F22=Alternative keys         F24=More keys                                    
                                                                                
Then convert each field to a constant by putting the cursor on the first character of each literal and hitting F11 twice.
Key the word TOTAL in the text area of the record. Convert the word to a constant by placing the cursor on the first letter of the word and hitting F11 twice. Now, add a new field for the accumulated total. This can get confusing.

For doing above operation follow the following steps. Create one more record format having name Total add heading in field is also Total as shown on following screen –

Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                        
FLD1                       <.............>                                  
00002 +                    Student Details                                 
 HEADER                                                                        
FLD1       <....>     <..>      <.....>    <.........>     <...>               
00004 +    RollNo     Name      Address    Course Name     Marks               
00005 +                                                                        
DETAILS                                                                        
FLD1       <.>        <...>     <...>      <...>          <.>                  
00007 +    999        XXXXX     XXXXX      XXXXX          999                  
00008 +                                                                        
  TOTAL                                                                         
FLD1                                        <...>                              
00010 +                                     Total                              
00011 +                                                                         
        --------------------------- End of Report -----------------------------
                                                                               
 F3=Exit   F11=Define field   F16=Delete field                                  
 F22=Alternative keys         F24=More keys                                    
                                                                               
Now this ‘Total’ is not available in Physical file so that you have to insert it externally. For that put curser in front of that and press ‘F11’ to get the following screen

                                                  Define Field Information                           
                                                                                
 Edited length . . . . . . . . . . . . :   1                                   
 Record format . . . . . . . . . . . . :   TOTAL                               
 Number of keywords  . . . . . . . . . :   0                                   
 Number of indicators  . . . . . . . . :   0                                   
                                                                               
 Type choices, press Enter.                                                    
                                                                                
   Field . . . . . . . . . . . . . . . .   FLD001        Name                  
   Option indicators . . . . . . . . . .                 01-99, N01-N99        
     More indicators . . . . . . . . . .     N           Y=Yes, N=No           
   Starting line . . . . . . . . . . . .                 1-255                 
   Starting position . . . . . . . . . .    +3           1-255, +nn            
   Length of data  . . . . . . . . . . .     1           1-378, +nn, -nn       
                                                                                                                                                           
                                                                               
                                                                        More...
 F3=Exit   F5=Refresh   F10=Work with keywords   F11=Convert to constant field 
 F12=Cancel                                                                    
                                                                               
In above screen rename Field FLD001 to ‘TOT’ and length 3 as shown below

                                                   Define Field Information                           
                                                                               
 Edited length . . . . . . . . . . . . :   1                                   
 Record format . . . . . . . . . . . . :   TOTAL                               
 Number of keywords  . . . . . . . . . :   0                                   
 Number of indicators  . . . . . . . . :   0                                   
                                                                               
 Type choices, press Enter.                                                    
                                                                                
   Field . . . . . . . . . . . . . . . .   TOT           Name                  
   Option indicators . . . . . . . . . .                 01-99, N01-N99        
     More indicators . . . . . . . . . .     N           Y=Yes, N=No           
   Starting line . . . . . . . . . . . .                 1-255                 
   Starting position . . . . . . . . . .    +3           1-255, +nn            
   Length of data  . . . . . . . . . . .     3           1-378, +nn, -nn        
                                                                               
                                                                                                                                                              
                                                                        More...
 F3=Exit   F5=Refresh   F10=Work with keywords   F11=Convert to constant field 
 F12=Cancel                                                                    
                                                                               
After changing field and length of data hit enter.
  
Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .          
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                        
FLD1                       <.............>                                
00002 +                    Student Details                                 
 HEADER                                                                        
FLD1       <....>     <..>      <.....>    <.........>     <...>               
00004 +    RollNo     Name      Address    Course Name     Marks               
00005 +                                                                        
DETAILS                                                                        
FLD1       <.>        <...>     <...>      <...>          <.>                  
00007 +    999        XXXXX     XXXXX      XXXXX          999                  
00008 +                                                                        
  TOTAL                                                                         
FLD1                                        <...>   <.>                        
00010 +                                     Total   XXX                        
00011 +                                                                         
        --------------------------- End of Report -----------------------------
                                                                               
 F3=Exit   F11=Define field   F16=Delete field                                  
 F22=Alternative keys         F24=More keys                                    
Field FLD003 created in record format TOTAL.                                   

Finally, add the date and page counter to the first heading line. Do this by adding a field of the appropriate length, converting it to a constant and then selecting the appropriate keyword. To add page number select ‘field level keywords’ from screen by pressing shift F11 on screen and select option PAGNBR press enter still main screen display.



Columns . . . :    1  62        Design Report                       PB01U01D/MYPRTF
 RLU==>                                                                   PRTF1
 BASE    ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 .         
        ------------------------- Start of Page 001 ---------------------------
HEADER1                                                                        
FLD1                       <.............>              <..>   <..>            
00002 +                    Student Details              page   9999            
 HEADER                                                                        
FLD1       <....>     <..>      <.....>    <.........>     <...>               
00004 +    RollNo     Name      Address    Course Name     Marks               
00005 +                                                                        
DETAILS                                                                        
FLD1       <.>        <...>     <...>      <...>          <.>                  
00007 +    999        XXXXX     XXXXX      XXXXX          999                  
00008 +                                                                        
  TOTAL                                                                         
FLD1                                        <...>   <.>                        
00010 +                                     Total   XXX                        
00011 +                                                                         
        --------------------------- End of Report -----------------------------
                                                                               
 F17=File keywords    F18=Record keywords                                      
 F23=Field keywords   F24=More keys                                            
                                                                               
Exit RLU with F3. You can save the DDS, compile it and generate a prototype report all from the exit screen.

Figure 1 - This is the finished report designed by RLU.  
  
 Following is the simple and complete RPG program to print the report.
 
FSTUD1      IF   E           K       DISK                                    
FQPRT        O    E       60         PRINTER
C                       SETON      60
C                       READ        RSTUD                                   90
C     *In90         DOWEQ     *Off                                    
C     *In60         IFEQ          *ON                                      
C                       WRITE       HEADER1                                    
C                       WRITE       HEADER                                    
C                       MOVE        *Off          *IN90                      
C                       ENDIF                                             
C                       ADD           MARKS         TOT                    
C                       WRITE        DTL                                     
C                       READ         RSTUD                                   90
C                       ENDDO                                             
C                       WRITE       TOT                                    
C                       SETON                                                     LR



No comments:

Post a Comment