Problem solve Get help with specific problems with your technologies, process and projects.

Printing techniques: Enhance reports with highlighted or underlined text

Learn how to highlight or underline fields using RPG specs or printer files.

You Can View User Feedback To This Tip


Dwight Beech

Have you ever wanted to highlight or underline a field in a report? This can be done two ways: by using a print file (PRTF) or embedding the code within the print specifications of an RPG program. The PRTF can be edited using SEU or RLU (Report Layout Utility).

If using a PRTF, then using the HIGHLIGHT keyword takes care of it easily. This keyword can be used at the record and field levels. When inserted into the PRTF, HIGHLIGHT automatically performs an overstrike so the field is highlighted or made bold.

The UNDERLINE is used only at the field level, and it specifies that the field to be printed will also contain an underline.

Here is the sample code for HIGHLIGHT and UNDERLINE.

*&-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
 *&    HIGHLIGHT AND UNDERLINE EXAMPLES                             * 
 *&                                                                 * 
 *&     CREATION    - 11/18/2002   DWIGHT BEECH                     * 
 *&                                                                 * 
 *&-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 
A          R PAXRNX                                                   
A                                    11'EMPLOYEE NAME:'               
A                                      HIGHLIGHT                      
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*  
A          R TOTLM                                                    
A                                    46'NAME'                         
A                                      UNDERLINE                      
A                                    68'ADDRESS'                      
A                                      UNDERLINE                      

Another method is to insert printer controls within the print specifications of your RPG program. This can be accomplished by inserting a zero in the SPACE AFTER field in the first occurrence of the print record PRTHDR and then subsequently inserting a one in the SPACE AFTER field in the second occurrence of PRTHDR.

At print time the program executes the WRITE statement of the first occurrence of PRTHDR and will not skip a line space. So when PRTHDR is executed again, it will then overstrike the same area specified. (See example below.) You can execute an underline sequence the exact same way as shown in the underline example.

Highlight example:

   O        E  0             PRTHDR                    
   O                                  108 'Time:'      
   O        E  1             PRTHDR                    
O        108 'Time:'      

Underline example:

   O        E  0             PRTHDX                    
   O                                  108 'Time:'      
   O        E  1             PRTHDX                    
O                                  108 '____'      

The ability to provide highlighting and underlining can enhance your report presentation immensely. The only caution is that highlighting and underlining may not work properly on all printers, especially some of the older models.

-----------------------------------
About the author: Dwight Beech is superintendent, application support, at Cameco Corp. in Saskatoon, Saskatchewan, Canada, where he manages the operation of the application support group supporting 35 business applications.

USER FEEDBACK TO THIS TIP

  • If you code your "O" spec this way you will be unable to to see the column heading if you look at the report using the WRKSPLF command You need to print the underline first the column heading.

    Underline example:

     
       O        E  0             PRTHDX
       O                                  108 'Time:'
       O        E  1             PRTHDX
       O                                  108 '____' 
    — Bryan Dietz

==================================
MORE INFORMATION
==================================

  • Modifying the WSCST to adjust the first print line
    Site expert Tim Granatir advises how to modify the WSCST to move the first print line down the page on certain IP printers.
  • Change report info without running the program again
    Has there ever been a time when you wished you could change information on a report without having to run the program again? Well, wish no more. By following these seven steps, you can have that report changed in minutes.
  • Using SDA to create printer files
    Did you know you can use Screen Design Aid (SDA) to create printer files? All of us use SDA everyday to create screens, but the only tools we have for printer files are SEU, RLU and Code Designer. Site expert John Kohan said he's seen people code extraordinary printer files in SEU, but the mass of RPG programmers just do not do enough printer files to hone skills to that level. Follow these steps to learn how to use SDA instead.


Dig Deeper on iSeries ILE programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close