Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Calling IBM i programs from EGL using Rational Business Developer

Claus Weiss, Advisory Software Consultant, IBM
Claus Weiss is an advisory software consultant with the Rational Software System i – Ecosystem team at the IBM Canada Toronto Laboratory. He has degrees in industrial engineering and computer science from the University of Hamburg in Germany. He worked as a systems engineer with IBM Germany and joined the IBM Toronto Laboratory in 1984. He was a developer and team leader for System/38 development tools. He has been a member of the Design Control Group for the AS/400 development tools. He has worked as a consultant for IBM iSeries Application Development for the past 10 years, specializing in Visual Tools. Claus is a frequent speaker at COMMON and other iSeries conferences and a six-time winner of COMMON's Speaker Excellence award. He is also the lead author of the book title "Understanding the IBM WebFacing Tool," published by IBM Press, and has co-authored several IBM Redbooks.

Summary:  This tutorial describes how to write Enterprise Generation Language (EGL) code that calls programs (RPG, COBOL, CL, CL Commands, or programs written in any supported language) on your IBM® System i5™ machine. The process for you to call an existing IBM i™ program from EGL has been very much improved in IBM® Rational® Developer for System i™ V7.1 (and later), and is incredibly simple. EGL leverages the IBM i Toolbox for Java™, which in turn utilizes the System i5’s Remote Command Host Server (QZRCSRVSD in the QSYSWRK subsystem).

Date:  19 Aug 2008
Level:  Intermediate PDF:  A4 and Letter (3472 KB | 44 pages)Get Adobe® Reader®

Activity:  290 views
Comments:  

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

5 of 9 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, Sample IT projects
ArticleID=330659
TutorialTitle=Calling IBM i programs from EGL using Rational Business Developer
publish-date=08192008
author1-email=weiss@ca.ibm.com
author1-email-cc=