Explore Enterprise Generation Language (EGL) introduction
Time required
To complete this tutorial, you will need approximately 2 hours and 30 minutes. If you decide to explore other facets of EGL or dynamic Web sites while working on the tutorial, it could take longer to finish.
Prerequisites
You will be best prepared to complete this tutorial if you have programmed in any third- or fourth-generation language such as COBOL, RPG, or a client/server language; and if you are familiar with these topics:
- SQL; or at least relational-database terms such as table, row, and column
- Basic Web-related terms such as browser, Web page, and Web application server
Learning objectives
In this tutorial, you learn how to do these tasks:
- Set up and configure an EGL project
- Create EGL source code
- Create two simple Web pages that access data in a relational database
- Pass a parameter from one Web page to another
- Configure a Web application server and run an application on that server
Tutorial and technology overview
The first of your Web pages shows a customer list from data stored in a relational database:
The second Web page shows details about one customer selected by the user and allows the user to change those details:
EGL is the language you use to oversee the interaction between the user and the database:
- After retrieving data from the database, the functions you write in EGL can apply business rules as appropriate.
- When preparing to present data to the user, those functions can alter characteristics of the Web-page display, even choosing which page to present.
- On accepting the user's response, those functions can apply additional business rules before storing the data.
As shown in this tutorial, EGL promotes code reuse in several ways:
- First, EGL lets you define dataItem parts, which contain information about data. These parts are similar to entries in a data dictionary, with each part including details on data size, type, formatting rules, input-validation rules, and display suggestions. You define a dataItem part once and can use it as the basis for any number of primitive variables or record fields.
- Second, EGL lets you define record parts, which are used as the basis for structured data. You might use this kind of part to create variables that access a file or relational database.
A record part can reference a series of dataItem parts, as shown in this tutorial. If you organize your data in this way, you can realize a more consistent definition of your data parts and can increase efficiency over time. Your changes to a single dataItem part will cause a change in every variable that accesses the related, stored data.
- Third, EGL lets you create source libraries, which contain functions, variables, and constants that provide a basis for logic reuse and for modular programming based on proven code.
EGL also provides the Data Parts wizard, which saves you from having to write the elementary code necessary to access a relational database. The outputs of this wizard are EGL parts that have specific purposes:
- Each record part reflects the characteristics of a database table.
- Each dataItem part reflects the characteristics of a table column.
- Each source library includes functions to create, read, update, and delete rows in the database.
The library functions include parameters that are based on the record parts created by the wizard. You can start to build a robust application just by invoking those functions with arguments that are based on the same record parts.
The controlling logic in the tutorial's application is a pair of page handlers, each of which oversees the user's run-time interaction with a Web page. A page-handler function is invoked by a user click, and the function in turn invokes a library function that you create. The result is that a user working at a Web browser can view and alter data stored in a database.
Tutorial exercises
You must complete the tutorial exercises in order. When you are ready, begin Exercise 1: Setting up EGL.
- Exercise 1: Setting up EGL
- Exercise 2: Creating and configuring the EGL project
- Exercise 3A: Starting and configuring WebSphere v5.1 Test Environment
- Exercise 3B: Starting and configuring WebSphere Application Server v6.0
- Exercise 4: Creating EGL data parts
- Exercise 5: Creating an EGL library
- Exercise 6: Creating a Web page
- Exercise 7: Adding data to the page
- Exercise 8: Linking to another page
- Exercise 9: Creating an update page
- Summary