AS400 Technology
Thursday, 10 April 2014
Showcase Article - Report Layout Utility (RLU)
Learning to use the tools on the AS/400 is one of the best ways to leverage your expertise. Managers may be surprised to learn how easy it is to provide users with sample report layouts that can be designed with an on-line tool. This on-line tool is RLU, Report Layout Utility. Because many programmers find its interface to be confusing, not many have become proficient RLU users. Read on and you will learn to create report layouts quickly and easily.
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:
Figure 1 shows the finished report that we will design with RLU. To start RLU, enter the command STRRLU and hit F4. Enter QDDSSRC as the source file. Enter the library name and CUSW005 as the source member. 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. RLU now displays its DESIGN REPORT screen. 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. Right now RLU shows the word, BASE in the upper left portion of the screen to indicate that the base set of function keys is in use. F22 changes to the alternate keys and the changes the display from BASE to ALT. 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. 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. The heading for the report will be CUSTOMER ANNUAL PURCHASES. On the line with RCD001, key in the heading. Then, convert this string of characters to a constant. Do this by placing the cursor on the first character of the heading and hitting F11 for DEFINE FIELD. Hit F11 again and then ENTER to convert the string of characters to a constant. 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 customer 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. Next, use RLU to retrieve the field definitions from the master file. Hit F10 for DATABASE FIELDS. Key 1 for the option to ADD FIELD. Leave the FIELD value blank. Enter the library name and CUST for the File. Enter the record name of the CUST file. RLU will then retrieve all the fields in the CUST file and list them. Select the fields for the report. Hit ENTER until you return to the DESIGN REPORT screen. The names of the fields you selected are at the bottom of the screen. Each field is sequentially numbered. To insert 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. If you overlap fields, RLU can get confusing. The simplest way to recover is to delete the record by keying a D in the command area of the record. Then start the record over. If you want to remove a field, put the cursor on the field and hit F16. 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 that you have placed the fields in a detail record, create headings for the detail line. Insert a line above the detail line. As always, key DR for DEFINE RECORD and then VF to VIEW FIELDS. Simply key the headings in the text area of the blank record that you inserted. Then convert each field to a constant by putting the cursor on the first character of each literal and hitting F11 twice. To help visualize the report, create some sample data lines. Make 5 copies of the detail line by keying SD5 on the command line of the detail line. Now, add a line at the bottom of the report for the total annual purchases. Do this by keying I in the command line of the last record on the screen. As always, key DR and then VF in the command area of the record. 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. Place the cursor where you want the total amount to print. Hit F11 to DEFINE FIELD. On the DEFINE FIELD INFORMATION screen, change the name of the field from the default FLD001 to TOTPUR. Change the length of data to 9. Hit PAGE DOWN. Change the data type to 2 for ZONED and enter 2 for decimal positions. Then hit F10 to WORK WITH KEYWORDS. Select EDTCDE by keying 2 next to it. Hit ENTER and key 1 for the EDTCDE value. Hit ENTER a few times and you will see that you have added a field for the total purchases. 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. Also, rename the records by using F18 for RECORD KEYWORDS and then F10 to rename the record. Exit RLU with F3. You can save the DDS, compile it and generate a prototype report all from the exit screen. Figure 2 shows the complete RPG program to print the report.
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. Customer number
- 2. Customer name
- 3. Customer city
- 4. Annual purchase amount
- 2. Customer name
Figure 1 shows the finished report that we will design with RLU. To start RLU, enter the command STRRLU and hit F4. Enter QDDSSRC as the source file. Enter the library name and CUSW005 as the source member. 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. RLU now displays its DESIGN REPORT screen. 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. Right now RLU shows the word, BASE in the upper left portion of the screen to indicate that the base set of function keys is in use. F22 changes to the alternate keys and the changes the display from BASE to ALT. 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. 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. The heading for the report will be CUSTOMER ANNUAL PURCHASES. On the line with RCD001, key in the heading. Then, convert this string of characters to a constant. Do this by placing the cursor on the first character of the heading and hitting F11 for DEFINE FIELD. Hit F11 again and then ENTER to convert the string of characters to a constant. 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 customer 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. Next, use RLU to retrieve the field definitions from the master file. Hit F10 for DATABASE FIELDS. Key 1 for the option to ADD FIELD. Leave the FIELD value blank. Enter the library name and CUST for the File. Enter the record name of the CUST file. RLU will then retrieve all the fields in the CUST file and list them. Select the fields for the report. Hit ENTER until you return to the DESIGN REPORT screen. The names of the fields you selected are at the bottom of the screen. Each field is sequentially numbered. To insert 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. If you overlap fields, RLU can get confusing. The simplest way to recover is to delete the record by keying a D in the command area of the record. Then start the record over. If you want to remove a field, put the cursor on the field and hit F16. 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 that you have placed the fields in a detail record, create headings for the detail line. Insert a line above the detail line. As always, key DR for DEFINE RECORD and then VF to VIEW FIELDS. Simply key the headings in the text area of the blank record that you inserted. Then convert each field to a constant by putting the cursor on the first character of each literal and hitting F11 twice. To help visualize the report, create some sample data lines. Make 5 copies of the detail line by keying SD5 on the command line of the detail line. Now, add a line at the bottom of the report for the total annual purchases. Do this by keying I in the command line of the last record on the screen. As always, key DR and then VF in the command area of the record. 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. Place the cursor where you want the total amount to print. Hit F11 to DEFINE FIELD. On the DEFINE FIELD INFORMATION screen, change the name of the field from the default FLD001 to TOTPUR. Change the length of data to 9. Hit PAGE DOWN. Change the data type to 2 for ZONED and enter 2 for decimal positions. Then hit F10 to WORK WITH KEYWORDS. Select EDTCDE by keying 2 next to it. Hit ENTER and key 1 for the EDTCDE value. Hit ENTER a few times and you will see that you have added a field for the total purchases. 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. Also, rename the records by using F18 for RECORD KEYWORDS and then F10 to rename the record. Exit RLU with F3. You can save the DDS, compile it and generate a prototype report all from the exit screen. Figure 2 shows the complete RPG program to print the report.
Figure 1 - This is the finished report designed by RLU.
FLD1 <........> <.......................> <..> <...>
HDG1 01/04/2001 CUSTOMER ANNUAL PURCHASES Page 9,999
FLD1 <..> <...........> <..> <..........>
HDG2 CUS# CUSTOMER NAME CITY ANNUAL PURCH
00004 +
FLD1 <....> <.......................> <.............> <.......>
DTL 999999 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX 99,999.99
00006 S 999999 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX 99,999.99
00007 S 999999 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX 99,999.99
00008 S 999999 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX 99,999.99
00009 S 999999 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX 99,999.99
00010 S 999999 XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX 99,999.99
FLD1 <...> <..........>
TOTL TOTAL 9,999,999.99
Figure 2 - This is the complete RPG program to print the report.
FCUST IF E K DISK
FCUSW005 O E PRINTER OFLIND(*In99)
C Move *On *In99
C Read CUST 90
C *In90 DoWEq *Off
C *In99 IfEq *ON
C Write HDG1
C Write HDG2
C Move *Off *In99
C EndIf
C Add CUSAP TOTPUR
C Write DTL
C Read CUST 90
C EndDo
C Write TOTL
C Eval *INLR = *On
C Return
Viewing a Compiler Listing
To view the results of a program compiling, use the Work With Spool File command, WRKSPLF. You will see a list of reports in your spool file. It will look like:
Device or Total
Opt File User Queue User Data Sts Pages
QSYSPRT AIRPGMR PRTDGM RDY 1
QPJOBLOG AIRPGMR QPRINT AIRNRA RDY 2
QSYSPRT AIRPGMR PRTDGM RDY 1
QSYSPRT AIRPGMR PRTDGM RDY 1
QPJOBLOG AIRPGMR QPRINT TQE07 RDY 2
QSYSPRT AIRPGMR PRTDGM RDY 1
QSYSPRT AIRPGMR PRTDGM RDY 1
Each line is the name of a report on your Spool File. The most recent reports are at the bottom. Key a 5 next the report you want to view.
You should now be looking at the compiler listing. To quickly locate errors, key B (for bottom) in the CONTROL field and hit ENTER. You are now looking at the bottom of the compiler report.
If your program compiled successfully, the last few lines will look like:
* * * * * E N D O F F I N A L S U M M A R Y * * * *
Program CMNR020 placed in library AIR. 00 highest severity. Created on
* * * * * E N D O F C O M P I L A T I O N * * * * *
If not, it will look more like:
* * * * * E N D O F F I N A L S U M M A R Y
Compilation stopped. Severity 30 errors found in program.
* * * * * E N D O F C O M P I L A T I O N * *
To find the errors, hit the PAGE UP key until you see:
* * * * * E N D O F E X T E R N A L R E F E R E N C E S * *
5769RG1 V4R2M0 980228 RN IBM ILE RPG AIR/CMNR020
M e s s a g e S u m m a r y
Msg id Sv Number Message text
*RNF7031 00 61 The name or indicator is not referenced.
*RNF7066 00 1 Record-Format name of Externally-Described file is not
*RNF7030 30 1 The name or indicator is not defined.
*RNF7503 30 1 Expression contains an operand that is not defined.
* * * * * E N D O F M E S S A G E S U M M A R Y * * * *
These are the errors that need correcting. Anything with severity level 00 is NOT an error. To find the error, go to the top of the report. Do this by keying T in the CONTROL field and hitting ENTER. Then, key the error message ID in the FIND field. In this case, I keyed RNF7030 in the FIND field. Then, hit F16 to search. Remember F16 is SHIFT / F4. In my case, the errors look like:
*RNF7066 00 2 000200 Record-Format CUSREC not used for
*RNF7030 30 123 005200 The name or indicator SYSDTECC is
*RNF7503 30 123 005200 Expression contains an operand tha
The errors RMF7030 and RNF7503 need to be fixed. They are both related to sequence # 123 in the compile listing which is line number 52.00 in the source file. In my case, I misspelled a variable name. This caused 2 errors. Often, 1 error will cause more than 1 error message.
Wednesday, 9 April 2014
Saturday, 1 September 2012
Syllabus of iAS400
AS/400 Course Curriculum
OS/400 System Concepts & Architecture
Ø Overview of the system
Ø General awareness of the As/400 System
Ø Libraries, Files and Members
Ø Library list concept and related commands
Ø Functions of OS/400
Ø Architecture
Ø ADTS (Application Development Tool Set)
DB2/400 (DDS Interface)
Ø Overview of DB2/400 Concept
Ø Externally Described files
Ø Source Files
Ø Physical Files, Logical Files and Join Logical Files
Ø Field Reference Files
Ø Database Integrity
Ø Commitment Control and Journaling
Ø Creating tables
Ø Insert/Update/Delete Using SQL
Ø Using cursors in RPG/400
CL/400: CL Control Programming
Ø File Handling in CL/400
Ø Handling Errors and Messages
Ø Handling Data Areas
Ø Overriding file Attributes and the Scope of overrides
Ø Open Query File
Ø String Operators
Ø String Functions
RPG Programming (RPG/400)
Ø Introduction to RPG/400
Ø Specifications
Ø Operation Codes
Ø Subroutines
Ø Data Structures
Ø Tables and Arrays
Ø Indicators
Ø RPG Logic Cycle
Ø Sub Files
ð Load All Subfile
ð Page Load Subfile
ð Expanding Subfile
ð Message Subfile
ILE (Integrated Language Environment)
Ø Introduction to ILE
Ø Specifications
Ø Advantages of ILE
Ø ILE Program Concept
Ø Advanced Concept of ILE
Project
Ø Project Experience on Real Time environment
1. IBM i (AS/400) Programming
Topics Covered:
IBM i (AS/400) Introduction, IBM i
(AS/400) Basic Concepts, Work Management, System Management, CL/400,
CLLE, RPG/400, RPGILE, File Concepts
Syllabus:
IBM i (AS/400) Basic Concepts & Facilities
Control Language Programming
RPG III Programming
RPG IV Programming using ILE Concepts
Control Language Programming
RPG III Programming
RPG IV Programming using ILE Concepts
2. IBM i (AS/400) Administration
Topics Covered:
AS/400 i Series Introduction, IBM i
Basic Concepts, Work Management, System Management, CL/400, BRMS, System
Monitoring, Security, Audit, OS/400 Installation, Crash Recovery,
Troble Shooting
Syllabus:
IBM i (AS/400) Administration & Operation
3. CA/2E (SYNON) Programming
Topics Covered:
CA/2E (SYNON) Introduction, Data
Modelling, Access Path, Functions, Action Diagram, Advanced Data
Modelling Relations and Related Topics
Syllabus:
CA/2E (SYNON) Programming
4. Visual Lansa
Topics Covered:
Repository & Integrated
Development Environment, Working with the Visual LANSA IDE, The
Repository Tab, Working with the Repository, Create a LANSA RDML Process
/ Function Application, Format Source Code, Edit Source Code, Auto
Complete and Command Assistant, Execute Applications, Introduction to
Object Oriented Lab and Working with Basic Controls in Visual LANSA
Forms
Syllabus:
Visual Lansa
5. COBOL/400 Programming
Topics Covered:
Introduction, Working with Screen
Indicators, COBOL/400 Specifics, Designing Display files, Handling
Error and Informational Messaging, Avoiding Record Locking Problems,
Using Subfiles in COBOL, Windows
Syllabus:
COBOL/400 Programming
6. C ILE Programming
Topics Covered:
Files, ILE Concepts, Procedures, Modules, Activation Group, Service Program, Binding, Signature
Syllabus:
C ILE Programming
Subscribe to:
Posts (Atom)