Navbar menu

Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Purpose of RLU:

  • To design a report by defining it on the display, saving it as a DDS source, and creating a printer file.
  • Printer file is the same as of spool file which is used for reporting purposes.

Starting RLU:
  • Enter the source physical file name, library name, and the RLU (printer file) name that we are going to create.
  • We can also specify the page width. By default, it will remain as 132.
Start Report Layout Utility (STRRLU)
Start Report Layout Utility
  • To start RLU from PDM, select option 19 (Change using RLU) for the selected file from the display.
Creating record format and fields:
  • Each row will be defined as a record in a printer file.
  • Type DR (Define Record) on the sequence line to create a record.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • If we want more than one line to be a record, then use DRR at starting line number and end line number.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • In the below screen, highlighted rows are treated as single records. We can see a '+' sign at end of the rows which denotes that the particular row will come under the above record format RCD002.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • Use F18 and then F10 to rename the record format.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • To add fields for the record, we need a field row for that. type VF (View Field) on the row/record format.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Creating a Variable:
  • Press F11 on the view field's row and type the name of the field, length, and field types, then press Enter.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • The defined variable field will look like the highlighted.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • length of data prompt
      • 1 to 378 for an alphanumeric field
      • 1 to 31 for a numeric field
  • We can also use DF for defining a field.
  • To View/Change the attributes of the field put the cursor on the field and press F23 for field attributes.
  • To delete a field, use shift + F4.
Creating a constant:
  • Type some text and then use DC on the sequence line to create a constant.
  • Some of the default constant keywords are
      • *date
      • *time
      • *pagnbr
      • *datesys
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Adding database fields to RLU:
  • Press F10 and select the database file and field you want on the report.
  • Select the fields from the file we want to include. Once included, the file fields will be shown at the bottom.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • Type VF on the sequence line to get a variable field line.
  • Type 1 or 1c for the first field, 2 or 2c for the second field, and so on in the FLD line.
  • C stands for the field heading and it will be placed in another record format.
Adding Sample data fields:
  • Use SD on the sequence line to add sample data fields.
Limitations:
  • Some attributes specified are not reflected at the time of generation of the spool file.
    • E.g., Bold or Underline specified on any field or line does not get reflected on the spool file.
  • The entire field is dropped if the field is outside the report width boundaries.
Example PRTF designing in AS400 using RLU (Report Layout Utility)
Report Requirement:
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
Step 1:
  • Create a printer file and open it using the STRRLU command or use option 19 from the display.
  • We can split the report into 4 record formats.
    • Header 1
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
    • Header 2
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
    • Detail
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
    • Footer
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
Step 2:
  • Create a record format Header 1 by typing DR on the sequence line.
  • Once Defined, type VF (View Fields) to define labels and fields.
  • To create a label, type the label data inside quotes and press enter.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • To pass data to these fields, we have to define variables. Press F11 next to the label view field's row to define the variables.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Step 3:
  • In the Header 2 requirement, we have only the label field's data to be displayed.
  • Create a new record format using DR on the sequence line and name it as 'Header 2'.
  • Type VF on the sequence line to define the label fields. Type the label data inside quotes and press enter.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Step 4:
  • This is the important phase of the report design. We have to define database fields to our report.
  • Press F10 and select the database file and field you want on the report.
  • Once the file was selected, we can see the selected database file fields at the bottom of the RLU screen.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • Now to place the database fields in the correct position. Create a new record format (Detail) and view field for this.
  • Select and enter the field numbers to the position where we want to use and Press enter.
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • The final result will be shown below
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Step 5:
  • In Footer requirement, we have to create a label ‘Total No of student’ and variable of numeric data length of 3.
  • Our final report design will look like
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries

Step 6:
  • Now, write an RPGLE code to load the database records and perform the logic to our printer file.
  • RPGLE Code:
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
Printer file (PRTF) Design using Report Layout Utility (RLU) in AS400 | iSeries
  • We have used an OFLIND (Overflow indicator). If page overloads, we have to write header again like moving to next page.
  • Compile and call the RPGLE program.
  • Check in our spooled files, WRKJOB à opt 4. Our report will be present.

No comments:

Post a Comment