Converting Green-Screens

This section will guide you through the process of converting Green-Screen applications to a browser interface.

Introduction 

RPGsp’s Green Screen to Web conversion tool uses unique Dream Architecture technology to convert RPG+DDS or CL+DDS applications to true ILE RPG-CGI Web applications. The end result is a fully functional and customizable Web application.

Using RPGsp’s Green-Screen to Web conversion process, it takes only minutes to go from this:

To this:

 

What is the Dream Architecture?

The Dream Architecture is RPGsp’s unique method of simulating the traditional iSeries Green-Screen programming environment, including the program call stack, display files with multiple record formats, inherent record-locking, subfiles with updatable fields, and program parameters. It is especially well suited for converting Green-Screen programs to the Web.

Using the Dream Architecture, RPGsp’s Green-Screen to Web conversion process does not employ Web-Facing or Screen-Scraping technologies, but actually restructures the portions of code that deal with display files so that it will interact with HTML code instead. Only code that deals with display file processing is modified, leaving the original business logic intact.

What are the Advantages?  

The advantage of using RPGsp’s Green-Screen to Web conversion process over Web-Facing or Screen-Scraping methods is that the converted application is not tied to the original display file. RPGsp creates independent HTML code for the screens. Since the converted application does not depend on reading the 5250 data stream, it is not limited to what can be done on a Green-Screen. The converted application can be modified and expanded in any way. Some typical enhancements include:

Converted RPGsp applications also have the capability of running either in a browser or in a Green-Screen from one object. This allows you to maintain one set of source code for both Green-Screen and Web applications.

Since the converted program is a true ILE RPG-CGI Web application, it will perform much faster than a Web-Faced application.

Which Programs Need to Be Converted?  

Any program in your application that uses a display file needs to be converted. Programs that do not use display files, but call programs that do, also need to be converted. The tool can convert either RPG or CL code. Programs that do not use display files or call display file programs do not need to be converted. They can continue to be called in their original form.  

When converting multi-program applications, make sure to also convert any called programs (where necessary) before launching the application.  

RPGsp’s automated mass conversion tool can analyze your source code to determine which programs need to be converted.

 

Getting Started 

Before beginning a conversion project, you should take a few moments to set up the Green-Screen to Web options.

To begin the conversion, choose the Green-Screen to Web conversion wizard from the Wizards menu.  

Retrieving Source and Field Definitions

The first step in the Green Screen to Web Conversion Wizard is to retrieve the DDS source and display file field definitions. To do this, you must first specify the display file source member and the display file object, and then click on the blue button labeled "Retrieve Source and Field Definitions".

If you are converting a program that does not use a display file, but calls another program that does, enter *NONE for both the DDS Source member and the Display File Object.

 

Source File Name/Library

Type in the File Name and Library Name of the file that contains the DDS source member. The default file name is QDDSSRC. *LIBL is not acceptable for library name in this wizard.

DDS Source Member

Type in the source member name for the display file. You can also click on the button next to the DDS member field to browse for the member. This will most likely be the same as the Display File name. If you are converting a program that does not use a display file, but calls another program that does, enter *NONE here.

Display File Object / Library

Type in the Object Name and Library Name of the Display File Object. By default, the display file object will be filled in with the same name as the DDS source member, and the library name will be the same as the source file library name. *LIBL is not acceptable for library name in this wizard. If you are converting a program that does not use a display file, but calls another program that does, enter *NONE here.

 

Converting an RPG Program 

The Green-Screen to Web conversion process requires that RPG source code is in the ILE format. Older code that is not in the ILE format can first be converted to ILE by using IBM’s CVTRPGSRC (Convert RPG Source) utility that is available at no charge as part of OS/400 (i5/OS).  

RPGsp’s automated mass conversion tool makes use of CVTRPGSRC in batch mode to convert multiple programs, or even entire libraries.  There are also tools available from 3rd party vendors that will convert older RPG code to ILE.

After retrieving the source and field definitions, select Convert All Formats and Import RPG. After selecting any options you wish to set, click the "Convert" button to begin the conversion.

 

Layout Type

Layout determines how the fields and constants are organized (or positioned) on a page.

Table layout uses an HTML Table along with its rows and cells to position elements on a page, while Absolute layout uses pixel-based coordinates to position elements on a page.

Absolute elements are removed from the normal HTML flow and positioned using style sheet attributes. The position of an absolute element is specified in pixels from the top and left sides of the document.

In contrast to standard elements, absolute elements can be placed anywhere on the page by simply dragging and dropping them with your mouse. Normal elements, on the other hand, must follow the rules of top-to-bottom html flow, and therefore use HTML tables for positioning. While Absolute layout makes it easier to position elements in Design View, the HTML code tends to be more organized with a Table layout, which is important when it comes to coding the RPG logic around the HTML. Subfiles typically use Table layout.

Use iCopy

When this option is selected, wizard generated code that handles display files will be placed in iCopy segments. Using this option overrides the global setting for iCopy in the Green-Screen to Web Options.

Show All Subfile Records at Once

By default, RPGsp will generate code to handle the paging of load-all subfiles.

When this option is selected, the converted application will display all records in the subfile in the browser at one time. The user will have a scrollbar to navigate through the subfile.

Using this option will override the global setting in the Green-Screen to Web Options.

Theme

To select a theme for your application, click the browse button. A theme is an HTML template used by the conversion process. RPGsp includes many prebuilt themes.

Before beginning a large conversion project, you may consider creating a theme of your own to match your company's branding and colors. The conversion process looks for the "greenscreen.html" template file in a theme folder. If "greenscreen.html" is not present, "add.html" is used. Your theme may link to a CSS file which should include CSS class names that match Green-Screen attributes. For example, RI is the reverse image class, UL is underline, and BLU is the color blue. CSS files for existing RPGsp themes include a list of all applicable class names.

Inactivity Timeout

In this field, you can specify the time (in minutes), before your converted program will end due to user inactivity.

During the Conversion

Called Programs

During the conversion, RPGsp will attempt to determine if programs called by the converted program use display files. RPGsp needs to add code to these program calls to handle the displaying of HTML screens.

If RPGsp is unable to make this determination, it will prompt you for input.

In this example, the conversion process wants to know if the specified program call is to a display file program.

These checks can be disabled by enabling the Silent Conversion option in the global Green-Screen to Web options. When this option is enabled, RPGsp will assume that all calls are to display file programs.

Entry Parameters

When RPGsp converts a program that uses *ENTRY parameters, it will display the following notification:

This is a normal informational notification that lets you know that the calling program needs to be converted, or that the *ENTRY parameters need to be removed from the current program.

Compiling and Saving the Converted RPG Program

After the program is converted, you can compile it by selecting Build/Run->Compile from the menus, or by clicking the gears icon on the toolbar.

The RPGsp source for converted RPG programs is not saved automatically. You can save the program to either the local PC, IFS, or a source file named QRPGSPSRC by selecting File->Save As from the menus.

Launching the Converted RPG Program 

If your converted RPG program does not take *ENTRY parameters, it can be launched directly. Before launching the program, make sure that any called programs that use display files have also been converted.  

To launch the converted application, select Build/Run->Launch in Browser from the menus.

 

Converting a CL Program 

The Green-Screen to Web conversion process is also capable of converting CL programs. This includes CL programs that use display files, and also CL programs that call other interactive programs.  

To begin the conversion, follow the steps for retrieving the source and field definitions. When this is complete, select "Convert All Formats and Import CL", and select any options that you would like to set. Then, click the "Convert" button to finish the wizard.

 

Layout Type

Layout determines how the fields and constants are organized (or positioned) on a page.

Table layout uses an HTML Table along with its rows and cells to position elements on a page, while Absolute layout uses pixel-based coordinates to position elements on a page.

Absolute elements are removed from the normal HTML flow and positioned using style sheet attributes. The position of an absolute element is specified in pixels from the top and left sides of the document.

In contrast to standard elements, absolute elements can be placed anywhere on the page by simply dragging and dropping them with your mouse. Normal elements, on the other hand, must follow the rules of top-to-bottom html flow, and therefore use HTML tables for positioning. While Absolute layout makes it easier to position elements in Design View, the HTML code tends to be more organized with a Table layout, which is important when it comes to coding the RPG logic around the HTML. Subfiles typically use Table layout.

Theme

To select a theme for your application, click the browse button. A theme is an HTML template used by the conversion process. RPGsp includes many prebuilt themes.

Before beginning a large conversion project, you may consider creating a theme of your own to match your company's branding and colors. The conversion process looks for the "greenscreen.html" template file in a theme folder. If "greenscreen.html" is not present, "add.html" is used. Your theme may link to a CSS file which should include CSS class names that match Green-Screen attributes. For example, RI is the reverse image class, UL is underline, and BLU is the color blue. CSS files for existing RPGsp themes include a list of all applicable class names.

Inactivity Timeout

In this field, you can specify the time (in minutes), before your converted program will end due to user inactivity.

After the Conversion

The CL conversion process generates two files: 

 

The generated CL program is a converted version of your code that should be saved in a source file and compiled. The most common place to save this source is in your CGI library (RPGSP, by default). A QCLSRC file should already exist in this library.  

The generated RPG Smart Page is used to perform Web operations for the CL program, such as outputting HTML screens, reading HTML form input, and keeping track of state. This page should also be compiled. The page is not saved automatically. You can save it to either the local PC, IFS, or a source file named QRPGSPSRC by selecting File->Save As from the menus.

Launching a Converted CL Program 

CL programs cannot be launched directly in the browser. For this reason, you will need to create a starter program. A starter program is a simple RPGsp program that will call your converted CL program.

There are two methods for creating a starter program. RPGsp provides a starter program template in the samples folder. There is also a starter program code snippet that can be used.  

Using the Starter.rpgsp Program

The quickest way to create a starter program is to use the sample program provided in the RPGsp samples folder on the local PC. To open the sample program, select File->Open Local File. On the local PC, navigate to:

C:\Program Files\RPGsp\samples\STARTER.rpgsp

The starter program accepts a query string parameter named InitPgm. You can pass in the name of your converted CL program using this parameter. In this example, the starter program will be launched to call a CL program named MYCLPGM:

http://TestSystem:450/rpgsp/STARTER.pgm?InitPgm=MYCLPGM

The Build/Run->Launch in Browser option will automatically launch the starter program with the appropriate InitPgm parameter, when performed on a converted CL program.

If the InitPgm parameter is not passed to the starter program, it will attempt to retrieve the current user's initial program from the iSeries user profile. If present, the initial program will be called.

Using the Starter Program Snippet

To create a starter program using the snippet, open a blank RPG Smart page by selecting File->New->RPG Smart Page from the menus. Then, switch to Code View. Next, select "Starter Page" under the Green-Screen to Web category in the Snippets window.  

 

The snippet will prompt you for the name of the program to call. Enter the name of your converted CL program.  

 

Converting Only DDS to HTML 

It is also possible to convert just the DDS code for display files to HTML. This option is useful when you would like to reuse the present layout of your screens, but do not wish to convert the RPG or CL program logic.  

In addition to converting the DDS to HTML, RPG code is added to the screen to process any input fields and to display output fields. This will give you a good head start on redesigning the program logic. 

To convert just DDS screens to HTML, first retrieve the source and field definitions for your display file.  

Select the radio button labeled "Convert Selected Formats". A listing of all record formats in the display file will appear in the list box. You can then select the record formats you would like to convert to HTML.  

Overlay Checkbox 

When this option is checked, RPGsp will combine all selected record formats into one HTML page, or screen. When unchecked, RPGsp will generate one HTML page for each selected record format.  

Layout Type

Layout determines how the fields and constants are organized (or positioned) on a page.

Table layout uses an HTML Table along with its rows and cells to position elements on a page, while Absolute layout uses pixel-based coordinates to position elements on a page.

Absolute elements are removed from the normal HTML flow and positioned using style sheet attributes. The position of an absolute element is specified in pixels from the top and left sides of the document.

In contrast to standard elements, absolute elements can be placed anywhere on the page by simply dragging and dropping them with your mouse. Normal elements, on the other hand, must follow the rules of top-to-bottom html flow, and therefore use HTML tables for positioning.

While Absolute layout makes it easier to position elements in Design View, the HTML code tends to be more organized with a Table layout, which is important when it comes to coding the RPG logic around the HTML. Subfiles typically use Table layout.

 

Mass Conversions

RPGsp's Mass Conversion tool allows you to convert entire application systems and libraries to the Web in an automated process. The Mass Conversion tool has a component that runs on the iSeries to examine your source files and determine which programs use display files. It will also analyze the code to determine if a program makes calls to display file programs.

When the analysis is complete, the mass conversion process will produce a listing of programs that need to be converted, and a temporary copy of their source code. These files can then be imported into RPGsp for an automated conversion.

For more information on the Mass Conversion tool, please contact Profound Logic support.


Profound Logic Software, Inc.
http://www.profoundlogic.com/
(937) 439-7925