Progress Programming Tips
By Rod Gaither (rdg@worldinfo.com)
PPT-27 Progress.ini based application modes
Tip:
During the process of developing an application there are (at least)
three modes of operation - Development, Testing, and Production. It
is handy to have the application know what mode it is being run in so
it can act differently in some circumstances. For example, when
running in development mode you want your application exit process to
just return - thus staying within the Progress environment. In both
testing and production you probably prefer to quit on exit. You may
also choose to vary the error handling and message reporting.
One way to easily set up an application mode is to use a special
section in the progress.ini file. Within this [Application] section
you can define basic defaults and settings to be read on startup.
An example -
In the ini file
[ShopPro]
LoginType=Auto
UserLogin=RDG
UserPasswd=RDG
DefaultSite=WIS
AppMode=Development
In the first program run
GET-KEY-VALUE SECTION "ShopPro" KEY "AppMode" VALUE g-app-mode.
This combination puts the value "Development" into the variable
g-app-mode. In our application g-app-mode is a local variable that
can be queried via a procedure call. It could just as easily be a
global variable, an attribute in a smartobject, etc.
In addition to the application mode setup we also allow for two
types of login - automatic or prompted. When set to automatic it
doesn't use a login dialog but gets the user and password from the ini
key elements. This is another example of making it easy to run one
way for development and testing, while another when running in
production.
Wisdom:
Programmers are not by nature consistent creatures. Develop
mechanisms and review processes to help insure consistency in
techniques and application behavior.
Rod Gaither | rdg@worldinfo.com
World Information Systems | (910) 333-2580 Voice
Greensboro, NC | (910) 333-2584 Fax