forminit Statement--Declare a Form
This statement declares a form to the FRS.
Syntax
forminit formname {, formname}
Description
The forminit statement declares a form to the FRS. Declaring a form makes its definition known to the FRS. You must declare a form before you can use it in an application. However, after a form has been declared, the application can display it any number of times. Forminit is used only to declare uncompiled forms. If you are declaring a form that was compiled in VIFRED, you must use the addform statement.
Because the forminit statement retrieves the form's definition from the forms catalogs in the database, you must issue it after the application connects to the database. Do not place this statement in a host variable declaration section.
Formname identifies the form and can be specified using a character string, with or without quotes, or as a program string variable.
If no transaction is open when your application issues the forminit statement, then forminit issues a commit afterwards, which releases all its shared locks. If a transaction is open, then forminit does not commit afterwards and your application continues to hold shared locks on the forms system catalogs until the next commit or end transaction statement.
Forminit takes shared locks on the forms system catalogs. These locks allow others to access the forms in the catalogs but not to change them. If the form has a VIFRED table look-up validation defined for it of the type field in table.column, then forminit also takes shared locks on the table specified in the validation.
Because of this, applications must, whenever possible, commit open transactions prior to issuing a forminit statement.
Examples--forminit statement:
Example 1:
Declare the forms empform and deptform.
exec frs forminit empform, deptform;
Example 2:
Inside a local procedure, which is called more than once, control the reissuing of the forminit statement. Drop shared locks on forms system catalogs by issuing commit after the forminit.
added integer; /* statically initialized to 0 */
...
if (added = 0) then
exec frs message 'Initializing form...';
exec frs forminit empform;
exec sql commit;
added = 1;
end if;
Last modified date: 04/03/2024