The unassigned() function indicates whether a variable has an assigned value.
|Variable to check for assignment.
The unassigned() function returns a non-zero value (true) if the variable (var) is currently unassigned. If the variable has an assigned value, a 0 (false) is returned.
The unassigned() function determines if common variables have been previously assigned.
The unassigned() function works well in BASIC subroutines called from the call AQL processing code. It prevents files from being repeatedly opened and variables from continually being re-initialized.
Use the unassigned() function when an application attempts to open files only once and keeps the file variables in a COMMON block.
It is more effective to modify the open statements in existing programs, for example:
if unassigned(var) then open ... to var ...
This can be done rather than change the application to open all files as soon as the user logs on and remove all subsequent open statements from all other existing programs.