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
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.

  • If we want more than one line to be a record, then use DRR at starting line number and end line number.
  • In the below screen, highlighted rows are treated as a 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.
  • Use F18 and then F10 to rename the record format.

  • To add fields for the record, we need a field row for that. type VF (View Field) on the row/record format.


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.

  • The defined variable field will look like the highlighted.
  • 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


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.
  • 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:
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
    • Header 2
    • Detail
    • Footer
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.

  • 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.

Step 3:
  • In 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.

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.
  • 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.
  • The final result will be shown below

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

Step 6:
  • Now, write an RPGLE code to load the database records and perform the logic to our printer file.
  • RPGLE Code:
  • 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