Running a Green Screen Application in Genero

Abstract

As we’ve described in other articles, there are many reasons to upgrade from Informix 4GL to Genero; however, it’s not always desirable to upgrade your entire application in one go from a Text User Interface (TUI) to a Graphical User Interface (GUI). This article focuses on how you can use Genero to run a green screen application in its native format, whilst allowing part of the same application to be rendered as a GUI application.

Content

The major benefits of migrating from Informix 4GL to Genero include:

  • the improved interface (better application navigation and user productivity features)
  • integration with desktop productivity tools and document management systems
  • more intuitive and richer data display

These benefits are all the byproduct of using a modern Graphical User Interface (GUI). But let’s say that you want to convert only part of a larger application to a GUI, and you want to retain the remainder as a green screen application.

In this case, your first pass could be to recompile the code: from the command line, set the environment variable FGLGUI to 0 (effectively ‘off’) and use ‘fglrun application.42r’. Your software will then operate pretty much exactly as it did as 4GL. So the users will still be 100% familiar with all aspects of the application, and you are still getting the benefit from all the time, money and effort put into developing your application.

The conversion from 4GL to green screen Genero is very straightforward; it would normally require only minimal modifications to the source code and for a relatively simple application little more than a recompile. As mentioned in the Caveats section below, where another executable is invoked or the application references library functions written in other languages, further development will be required.

Example 1: Informix 4GL Menu

In the example below, the application has a very complex menu structure (which runs over 250 executables), with each sub menu opened in a separate window. The first screenshot below is from executing a command line Informix 4GL utility, and the second is from executing a Genero equivalent. As you can see they look identical. They behave identically too. No code change was required. No database change was required.

Original 4GL

Substitution: Image 1

Genero in TUI mode

Substitution: Image 2

Example 2: Informix 4GL Form

In the following example we are demonstrating the rendering of a very simple form using Informix 4GL and Genero. The first screenshot below is from executing a command line Informix 4GL utility, and the second is from executing a Genero equivalent. As above, there are no differences visually, operationally, or in the code or database.

Original 4gl executable

Substitution: Image 3

Genero in TUI mode – code unchanged

Substitution: Image 4

Genero Studio (GST)

Genero Studio is a graphical Integrated Development Environment for developing and managing Genero applications, but it can also be used to manage, edit and compile traditional Informix 4GL code. This immediately brings the benefits of a modern IDE (e.g. visual code editing; project management; integrated source code management; source file comparison; interactive debugging etc.) to a more traditional 4GL environment.

The Project Manager completely replaces using ‘i4gl’ (or ‘r4gl’) and the ‘syspgm4gl‘ database, and is vastly more productive; for instance when using source code management you can see which forms, 4gl and others you have modified since the last commit, what those modifications are, view the entire history etc.

Importing and building an Informix 4GL application into Genero Studio is straightforward;

  • Create a managed project and import your source files
  • Create an entry for each executable in the project structure
  • Add (at the project level) one or more libraries for common files and another for the database schema definition
  • Select the “build” option for a specified application which will compile all applicable files and link them, creating the executable

Note that there is also the Rebuild option, which will recompile all files for the executable, regardless of whether or not they have been modified. And the Build and Rebuild options are also at the project level to recompile everything in one hit – you may need to do this if there have been changes to library files, or the database structure, for instance.

Incremental Deployment

Migrating a full application from green screen to an enhanced GUI could take a fair amount of time and effort, but if the database structure is unchanged then the code could be easily updated piece by piece. In example 1 above, the ‘Client’ functionality could be migrated first, leaving the original code (in TUI mode) available for ‘Operations’, ‘Reports’ etc., with both sets of code accessing the same database. Then perhaps ‘Operations’ can be migrated, followed by ‘Reports’ and so on.

In Genero Studio, this is achieved by breaking a large “project” into appropriate groups (and subgroups) and putting the “applications” where appropriate. This will not affect the structure of the application; it is simply a more intuitive view of the executables that make up the project.

Substitution: Image 5

Caveats

If in your code you invoke another executable e.g. ‘RUN “module.4ge”‘ you would need to alter the code to ‘RUN “fglrun module.42r” ‘. The original statement will still work, but if you’ve moved on to a new platform you would need to install 4GL, recompile that code and have the appropriate 4GL licenses. And depending on the structure of your application it might mean that you are still running the bulk of it as 4GL. Note that we not aware of any clash between 4GL and Genero – they will run together on the same server.

Genero will also handle the ‘C’ (as well as several other languages, such as Java) functions used in your 4GL code. It is supported a bit differently, but requires just a few minutes of work and it is fully documented.

  • Modify ‘#include’ for the 4GL headers in the C code
  • Create a ‘C interface file’ which defines all the functions in that C file
  • Compile into a shared library file, with the interface file
  • Import into the 4GL modules where relevant, either using an ‘IMPORT’ statement in the source code, or by including them when linking the executable (or library file)

If your application is still green screen, not all Genero code enhancements can be used, also some features in Genero Studio are incompatible e.g. Form Designer – this does not create an ASCII ‘per’ file, rather an XML file structured for a graphical interface, although of course the ‘.per’ files are fully included in the Genero Studio project management (editing, compiling, source control etc.).

Basic “Green Screen” executables can also run via Genero Desktop Client (GDC) or Genero Web Client (GWC), but these tools are both designed for a graphical interface, so one will most likely need to do some work to make it user friendly. That shown in the second example above, because it is quite a small and basic application, does operate via GDC/QWC very much as it would from the command line. But using GDC to run the application shown in the first example will open each sub menu in a separate window on your desktop with a set of buttons (for the menu entries) down the right hand side, which is totally different to how it operates in TUI mode. It will work, but will look more messy than modern; it would be relatively straightforward to upgrade it though, simply replacing all the code which triggers the executable with a ‘Start Menu’ – have a look at Navigating a Genero Application.

Conclusion

Phase 1 of your upgrade project can be to move, with minimum effort, to a modern and fully supported platform (the hardware, O/S, database etc.) and Genero, and keep using your legacy green screen application in a completely viable environment. Phase 2 can then be to upgrade the interface and functionality incrementally.

Another benefit of Genero is that it is effectively like the Rapid Development System version of 4GL – “compile once, test once, run anywhere”. For example, one of our customers is running an application on Windows Server 2012 that is fully managed on a Linux platform by our company – once tested all we need to do is deploy those executables to the customer’s server. As you might expect, Genero Studio is available on various platforms too.

Disclaimer

The above is provided "as is" without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement.