In order to re-use external descriptions of fields, records, or externally defined structures, you can use the capabilities of IBM® Rational® Business Developer to point to a data base table to get its description and create EGL data description from it.
You will use the EGL Data Access Application wizard .
- Right-click the eglcallweb project and Select New > other > EGL > EGL Data Access Application, as shown in Figure 18.
Figure 18. Select a wizard
You will need to create a new database connection
- Select the eglcallweb project from the drop-down list on the first page of the wizard, as shown in Figure 19.
- Next to the Database Connection input field, click the New button.
Figure 19. Define project settings
A new wizard page for the database connection appears. Configure the connection parameters as shown in Figure 20.
- Select the DB2 for i5/OS database manager from the tree view
- Select the correct V5R4 IBM® DB2® for i5/OS® release
Enter the host name
iseriesd.dfw.ibm.com, or the name that the instructor gives you.
- Enter egl4rpg as the User ID
- Enter egl4you as the Password
- Click Test connection
- After successful connection, click Next
Figure 20. Connection Parameters
The New Connection dialog appears. Select the options as shown in Figure 21.
- Clear the Disable filter check box
- Select the Selection radio button
- From the list of libraries, select EGLLABV7xx.
- Click Finish.
Figure 21. Select a library
Back in the Data Access Application wizard, you can now select the tables that you are interested in, as shown in Figure 22.
Select the CUSTOML3 table. This is the one that is used in the RPG program. It is the base for the record (structure) layout of the parameter to be passed from the IBM i program to the EGL Web application.
Important: Make sure that Create web pages is clear, because you are not interested in creating Web pages to access this table.
- Click Next to proceed to the next page.
Figure 22. Define project settings
- Under Choose key fields, select CUSTNO, as shown in Figure 23.
- Click Next.
Figure 23. Define the fields
The bottom dialog is disabled, because you cleared the option to create Web pages.
- Select to Qualify the table names with schema, as shown in Figure 24.
- Click Finish.
Figure 24. Define project creation options
Now you have the description of the record format, as well as its fields. You have to adjust it so that you can use it for an EGL Call, instead of the default Java™ Database Connectivity API (JDBC) data access.
The data access wizard creates a default record of type
sqlrecord and a search record. They are located in the file Customl3.egl in the s400a.data package.
You need to add a record of type
basicrecord to this file. The easiest is to copy the searchrecord that has been created and change the copy to a fixed length basicrecord.
The following step will show you how to do this.
- Copy and Paste the Customl3Search record below the custom source definition area, as shown in Figure 25. This is a protected area that will not be changed if you recreate the record definitions later on.
Change the record statement so that the name of the new record is Customl3ds1
and the type is
- Add the level number 10 to each field.
- Remove the ? from each field, because the question mark in EGL means a null terminated field. You don’t get null terminated fields from RPG unless you specify this explicitly.
- Save (Ctrl+ S). If errors occur, fix them.
- Close the editor.
Figure 25. Add a record