You might want to set the Transaction object values from an external file. For example, you might want to retrieve values from your PocketBuilder initialization file when you are developing the application, or from an application-specific initialization file when you distribute the application.
You can use the PowerScript ProfileString function to retrieve values from a text file that is structured into sections containing variable assignments, like a Windows INI file. The PocketBuilder initialization file is such a file, consisting of several sections including PB, Application, and Database:
[PB]
variables and their values
...
[Application]
variables and their values
...
[Database]
variables and their values
...
The ProfileString function has this syntax:
ProfileString ( file, section, key, default )
This script reads values from an initialization file to set the Transaction object to connect to a database. Conditional code sets the variable startupfile to an appropriate value:
SQLCA.DBMS = ProfileString(startupfile, "database", &
"dbms", "")
SQLCA.DBParm = ProfileString(startupfile, "database", &
"dbparm", "")