finalize Statement--Transfer Data
This statement performs final data transfers at end of display loop.
Syntax
finalize [(variable[:indicator_var] = fieldname
{, variable[:indicator_var] = fieldname})]
Description
The finalize statement transfers data from simple fields on a form into program variables at the end of the display loop. (You can transfer data from table field columns by means of the getrow and unloadtable statements.) Data is transferred from each specified field, identified by fieldname, into its associated variable.
You can specify fieldname using a character string, with or without quotes, or as a program string variable. The variable associated with each field must be a data type compatible with the field.
You must include the indicator variable if the field is nullable. If the retrieved data is a null, the indicator variable is set to -1. (If the retrieved data is a null and an indicator variable is not present, Ingres returns an error.)
Using an indicator variable can also provide a useful program check when the field holds character data even if the field is not nullable. When the retrieved character string is larger than the variable to which it is assigned, the string is truncated. In such instances, if an indicator variable is present, it is set to an integer indicating the full, untruncated length of the character string.
The finalize statement (if present) is executed when a form's display is ended by the enddisplay statement. If the display ends due to breakdisplay statement or if enddisplay is not executed for any reason, the finalize statement is not executed.
The FRS also executes the finalize statement when the user selects the Menu key to end the display. (The Menu key is used to end the display of a form that has no defined menu item operations and, thus, no menu items.)
The finalize statement is not required. However, even when it does not perform any data transfers, it provides a useful way to mark the end of the display block.
Examples--finalize statement:
Example 1:
Place data from the name and salary fields into program variables.
exec frs finalize (:namevar = name,
:salvar = salary);
Example 2:
Place data from the field specified by the variable fieldvar into the variable namevar.
exec frs finalize (:namevar = :fieldvar);
Example 3:
Get values from a nullable field.
exec frs finalize (:spousevar:indicator_var = spouse);