Ask Reuben

fglrun.defaults

How can I have different defaults for different programs ?

How can I do a slow rollout of a transformation of forms ?

The FGLPROFILE files(s) are the main configuration files for Genero applications.  One entry fglrun.defaults amongst the many entries for the core language has an often overlooked benefit that can aide in doing gradual rollouts.

The runtime has a defined order of precedence as to what fglprofile files are read.  As defined here, the order is

  • $FGLDIR/etc/fglprofile
  • Files as defined by the FGLPROFILE environment variable, note this can define multiple files.  The original Genero implementation this defined one file but an enhancement in 2.30 allowed this variable to define multiple files.
  • If the fglrun.defaults entry is defined in one of these files, its value will specify a directory.  The runtime will then look for a file that matches the program name in this directory.  That is if the program name is foo.42r, it will look for a file named foo in the fglrun.defaults directory.

This last entry had a use for customers during their initial transformation of their Informix-4gl application to Genero applications.  Rather than transforming all their screens from SCREEN to LAYOUT in one hit, customers could use Traditional Mode to initially render all their forms  using SCREEN to a GUI client, and then slowly as resources permitted, change forms to use LAYOUT.

This was achieved by doing the following …

  1. In a file referenced by FGLPROFILE environment variable (hopefully you do this rather than overwriting FGLDIR/etc/fglprofile), add an entry fglrun.defaults = "my_fglprofile_dir" where “my_fglprofile_dir” is a directory shipped with your application.
  2. For every program in your suite, add in the directory specified by “my_profile_dir”, a file whose name matches the name of every Genero program (less the .42r extension).  In each of these files, add the following line gui.uiMode = "traditional".
  3. When you finish transforming an individual programs forms from using SCREEN to LAYOUT, deploy the programs .42f files, and then find in the “my_profile_dir” directory the file with the same name as the program, either delete that file or change the gui.uiMode line to   gui.uiMode = "default".

When the entry for gui.uIMode resolves to “traditional”, the program will run in traditional mode.  When there is no gui.uiMode found or it has an entry of “default” then the program will run using normal Genero GUI rendering.

FGLPROFILE allows you to define your own entries and to read them using base.Application.getResourceEntry().  So you can use this technique not only for Genero configuration entries that are defined in FGLPROFILE, but you can add your own entries and place them in the fglprofile file as well.  If you do this I’d suggest using your own prefix for the name of the entries, that is leave the fglrun, Dialog, dbi prefixes to us.

Many years later from when you might have used this technique to move from TUI to GUI, this technique could also potentially be used to help with transforming screens to be responsive.  Create your own fglprofile entry and then if your 4gl program needs to run different depending if the screens are responsive or not, indicate this by an entry in each programs fglprofile file.  Your 4gl should not need to run differently but there may be cases such as loading a different .4st file depending if the forms are responsive or not.

Enterprise customers in particular may find this technique handy elsewhere as it means they can roll out changes gradually.  Change your important programs first and then gradually make the equivalent  change to all programs as resources permit.  As you make the change for each program, update the programs entry in the fglrun.defaults directory.