iSeries EGL

All things EGL for the iSeries / i5 / Power System

Front Page

leave a comment »

This is the home page containing links to available topics on EGL as used in an IBM iSeries environment. The posts presented below are grouped under major topics (titles in blue) such as Tomcat configuration, SQL, using EGL components, etc. While some topics are comprised of a short narrative, in most cases clicking on the subtopic’s heading will navigate to the post.

Some of the subtopics present coding practices reflecting industry standards. In some cases code is presented that are used as examples or used to advance a particular development idea, tip and/or technique.

If you feel there is a better way or you have identified a problem, by all means raise the issue by adding a comment to the end of each post. We’re all learning here.

Tomcat Configuration

This section lists posts on the topic of Tomcat, a Java application server that has been used in the corporate space for over a decade. The topics are mostly about how to configure Tomcat with values to be accessed by business applications. The values serve to identify the server as a development, test or production oriented server enabling the application to establish the correct DB connections as reflected by those environments.

It should be understood that these values have already been configured for Tomcat and do not require any further action by the developer. The only action required by the developer relates to actually reading the run-time environment variable that describes the role of the server and to perform a JNDI lookup to obtain a DB connection. For these, see the topic “How to read Tomcat environment variables using EGL” presented in this section and “Making a DB Connection during runtime” presented under the section for SQL, below.

Tomcat on the iSeries. Running Headless

When running Tomcat on the iSeries a few modifications to its startup script are required. First, the iSeries is headless, meaning it has no keyboard, monitor or mouse attached. (Yes, there are admin consoles, but this isn’t the same thing.)

Assigning a Tomcat instance to a development, test or production role

JVM variables can be defined on Tomcat’s startup command to declare a server instance as either a development server, a test server or a production server. An application can then retrieve this value during its startup processing phase to help it determine the proper database to which a connection must be made.

Register a Data Source with Tomcat

This post shows how to make JNDI-based entries into Tomcat’s context.xml file to register multiple database connection resources.

How to read Tomcat environment variables using EGL

This post shows how a Java class can provide a function not available by an EGL program. Specifically, it will show how to create an EGL External Type, an EGL Service and the code used to call the service to receive values returned by a Java program. This approach allows for the retrieval of Tomcat’s JVM variables that containing the runtime environment value assigned to a Tomcat server.

Best Practices and Standards

Standards. Love ’em or hate ’em, they are a necessary part of program development. Without them developmental chaos will reign supreme and will usually add up to time, effort and money wasted, none of which are desirable.

The posts under this section focuses upon best practices to employ while developing EGL applications and presents topics such as naming conventions, screen design, widget programming, source control, etc.

Why Have Standards?

Successful software development is a long term activity and for this reason it is expected that the code base will be maintained by a succession of many different programmers over a period of many years. Without choosing a coding standard, you’ll likely end up with an informal one anyway as each developer of the organization fills the vacuum by evangelizing their own set of pet coding rules. Employing different rules, this often leads to applications behaving differently and means each have different training requirements.

Standards will provide the following benefits.

  • Improved code maintainability.
  • Improved code quality. In particular: testability, supportability, portability, security, efficiency, robustness, high cohesion/loose coupling.
  • Improved development speed. Your developers don’t need to make all decisions starting from first principles.
  • Better teamwork. Don’t waste time with needless debates. Spend your creative energy on things that matter.
  • Make it quicker and easier for a developer to move to a different project or team.
  • Better performance under pressure. Under stress, people fall back on what they’ve been trained to do.
  • Fewer bugs. Good standards should minimize common coding mistakes.
  • Shallower learning curve and useful training for new hires — if your standard mandates proven, well-known idioms and style from the programming mainstream.
  • Address audit requirements.

These are among some of the reasons why a coding standard will make application development over the long term easier, more productive and ensure the user’s experience is consistent across all applications.

The coding standard should be something developers learn from, want to follow, and want to contribute to; it should make their lives easier, not harder.

The coding standard should be a living document having a mechanism for evolving it and for dealing with the millions of lines of old code that are affected by changes to it.

For another point of view on why standards are vital to good development check out Why You Need Coding Standards. Reading the first half generally covers the importance of standards. Although the web article concerns aspects of PHP development, it serves to show that no matter which language you are coding with, standards will help maintain consistency which will ultimately lead to increased familiarity across multiple programs allowing the developer to more quickly focus upon the business problem the program attempts to solve.


Source Control

Source control is a fundamental aspect of project development. There is no getting around this especially when multiple developers are involved. This link will present a page to download a PDF document that illustrates how to use Subversion (SVN), a version control tool, while using ‘Rational Developer for i’ (RDi).

While this Wiki page provides a great overview of SVN, documentation about SVN is available from the Apache Subversion Documentation page. The Subversion book is available on-line (free) and can be downloaded in PDF form.

These links will offer insight on SVN and how it goes about managing version control. This being said, the aforementioned PDF document that illustrates how to use SVN with RDi should be the focus for developers.

Naming Conventions

Naming conventions are an integral part of any serious application development effort. Developing EGL applications is no different and using them will minimize coding differences between them compared to being developed without them. They are presented here.

Project Naming

Generally speaking, name the project as you see fit, (following standards of course!) however keep in mind that at some point you will need to generate the web site from the EGL project. During this phase, the deploy wizard will ask you for a project name under which all of the generated Java, Javascript and HTML will be generated. This name will be the web site’s name, meaning it will appear in the URL for the web site. The web site’s name may very well collide with that very thoughtful name you provided for the EGL project itself and the two names cannot coexist under the EGL workspace.

For example, an EGL project is created and you call it “PolicyInquiry” and you begin coding the RichUI handler and services, etc. When time comes to generate the web site the wizard will ask (one time only) for the web site name. Well, “PolicyInquiry” would have been great, but it’s been given to the EGL project. Now what?

Do this; for the EGL project itself, append “Project” to the end of the name, i.e. “PolicyInquiryProject”. That way, when time comes to create the web site from which the .war-file is created to be deployed to the Tomcat server, you can then assign the web site name of “PolicyInquiry”.

As a side note, “PolicyInquiryProject” will be submitted to source control (Subversion), not “PolicyInquiry”.

Standard Look and Feel

To make an effort at establishing some kind of common look and feel, a starting template has been created for a Rich UI handler. It can be viewed here. The source code presented at this link can be used as the basis for a web application consisting of a single page with no navigation requirement.

While a template for a single page is useful for presenting a uniform look throughout the application, we now need a simple architecture to establish a uniform method of page navigation in addition to being able to pass data between pages. The architecture to support this is presented here.

Start-up Processing

Reading Property File Values From an XML File

This post shows how to read property file values that have been stored into an external XML file. This is commonly seen in web-applications and often occurs during the time the application starts. The solution presented shows how to read different property values as they relate to the role of the server in which the application runs. EGL does not yet offer a way to read XML files so this solution rests upon being able to call a Java program from an EGL Service program.

All things SQL (within an EGL context)

This list of topics covers just about anything related to SQL constructs, techniques and establishing database connections on the fly.

Making a DB Connection during runtime

This post will illustrate how a database connection can be established to one of two separate iSeries machines.

Developing Widgets and Using Components

This section is devoted to EGL and Dojo components.

EGL Tables – How to Control Text and Background Colors

This post illustrates how to control the foreground (text) and background (cell) colors of an EGL DataGrid component. For reference material, visit IBM’s documentation for DataGrid here.

A Simple Dialog Box

This post shows how to make a simple dialog box.

A Conversational Dialog Box that uses the InfoBus

This post takes dialog boxes to the next level where the user is allowed to interact with it by selecting either a “proceed” or “cancel” button. The twist with this one refers to the problem of communicating the user event back to the parent program that launched it.

Making and Using a Custom Widget

This post presents a widget that allows items to be selected from one list and moved to another. In addition it shows how widgets can be reused across multiple applications.

Defining Menu Icons with CSS

This post shows how to use CSS to define classes that reference an image. The class can then be referenced by a menu item so that the icon is presented along side it.

Browser Component Data Validation

This section is devoted to validating data from a browser component.

DojoTextField Validation

This post shows how to use the DojoTextField and validate input.

Importing Jar Files into EGL Projects

This section describes how to import jar files into the EGL project. It covers the creation of a jar file from a Java-based project and shows how to import it into the project.

Exporting Java Class files and Importing into EGL Projects

This post shows how to export a Java class file (or files) into a .jar-file to be imported into an EGL project. The purpose is to promote reuse of Java-based solutions across multiple EGL projects.

Calling RPG Programs From EGL Using PCML

This section describes how to call RPG Programs From EGL Using PCML. It covers the creation of the XML interface for the parameters to be passed in addition to showing the EGL code required to call the RPG program. To read further about PCML and how it is used to call programs on the iSeries, refer to this link. To dive right into the topic about how to call RPG programs from EGL using PCML, continue with the post below.

Use PCML and Java to Call an iSeries Program

This post shows how to call an RPGLE service program by calling a CL program using PCML.


Date and Time

Date and time calculations are common in business applications. This section is devoted to the topic of EGL’s implementation of date and time functions.

Using Date, Time, Intervals and Timestamps

This post shows how to use Date, Time, Intervals, and Timestamps to determine if the EGL application has been launched within the past five minutes using only the hours, minutes and seconds provided as an encoded parameter on the URL.


Sending eMail

Simply put, there are times when an application has to send an email.

How to use Java Mail with EGL

This post presents a single Java class that can be used without modification in any application supporting Java or calls to methods of a Java class. As a minimum, the class requires certain email server values to be supplied along with sender, Cc addresses, subject and email text. Mutator or ‘Setter’ methods are provided for this. In addition, if an attachment is required, such as a PDF document or a spreadsheet file, other methods provide the means to designate the directory and the name of the file. In the event that the class determines some values are missing, the process will abort. In any case, the process returns a list of messages in the form of an ArrayList object to indicate success or failure of the operation. In the case of EGL, which this site is all about, the list of messages are returned to the EGL caller as a string array.


EGL Dictionaries

Some interesting ways of using EGL’s Dictionary Record type. One way is to perform lookup operations.

Perform Lookup Operations

This post shows how to use EGL’s Dictionary Record to help translate codes to their corresponding long description and back again. This is great for translating codes stored on disk into their longer description loaded into a ComboBox. Of course, when the user selects the longer description, it will need to be converted to its code to be stored on the record. This post shows how that’s done using a Dictionary Record.




Written by iseriesadmin

June 9, 2012 at 12:42 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s