Skip to main content

skip to main content

developerWorks  >  Rational | Sample IT projects  >

Calling IBM i programs from EGL using Rational Business Developer

developerWorks
Go to the previous pagePage 5 of 10 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
3117 KB (66 pages)

Get Adobe® Reader®


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


Re-use descriptions

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.

Create the external description for the data structure parameter

You will use the EGL Data Access Application wizard .

  1. Right-click the eglcallweb project and Select New > other > EGL > EGL Data Access Application, as shown in Figure 18.

Figure 18. Select a wizard
list of wizards in a tree view

You will need to create a new database connection

  1. Select the eglcallweb project from the drop-down list on the first page of the wizard, as shown in Figure 19.
  2. Next to the Database Connection input field, click the New button.

Figure 19. Define project settings
Project name, database connection, list of tables
  1. A new wizard page for the database connection appears. Configure the connection parameters as shown in Figure 20.
    1. Select the DB2 for i5/OS database manager from the tree view
    2. Select the correct V5R4 IBM® DB2® for i5/OS® release
    3. Enter the host name iseriesd.dfw.ibm.com, or the name that the instructor gives you.
    4. Enter egl4rpg as the User ID
    5. Enter egl4you as the Password
    6. Click Test connection
  2. After successful connection, click Next

Figure 20. Connection Parameters
select JDBC driver and connection URL details
  1. The New Connection dialog appears. Select the options as shown in Figure 21.
    1. Clear the Disable filter check box
    2. Select the Selection radio button
    3. From the list of libraries, select EGLLABV7xx.
    4. Click Finish.

Figure 21. Select a library
scrollable list of libraries with check boxes

Back in the Data Access Application wizard, you can now select the tables that you are interested in, as shown in Figure 22.

  1. 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.
  2. Click Next to proceed to the next page.

Figure 22. Define project settings
specify project location and select tables
  1. Under Choose key fields, select CUSTNO, as shown in Figure 23.
  2. Click Next.

Figure 23. Define the fields
specify key and selection condition fields

The bottom dialog is disabled, because you cleared the option to create Web pages.

  1. Select to Qualify the table names with schema, as shown in Figure 24.
  2. Click Finish.

Figure 24. Define project creation options
default package name and data access method

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.

  1. 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.
  2. Change the record statement so that the name of the new record is Customl3ds1
    and the type is basicrecord.
  3. Add the level number 10 to each field.
  4. 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.
  5. Save (Ctrl+ S). If errors occur, fix them.
  6. Close the editor.

Figure 25. Add a record
modified code


Back to top



Go to the previous pagePage 5 of 10 Go to the next page