&DEFINED

Determines if a specific rule or variable has a defined value and returns a true value (1) if defined, and a false value (0) if not defined.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

Syntax:

&DEFINED( $rulename|&variablename)

Aliases:

&defined( $rulename|&variablename)
&Defined( $rulename|&variablename)

Comments:

Variable names used as formal parameters to rules can become undefined. All other variable types, such as global symbols, remain defined until the program terminates.

Examples:

If &FILE-2 and &FILE-3 have defined values, add them to the CLOSE statement.

CLOSE &FILE-1
% IF &DEFINED( &FILE-2)
    ... &FILE-2
% IF &DEFINED( &FILE-3)
    ... &FILE-3

Save two symbol lookups every time a loop is performed. You can replace this code

% REPEAT VARYING &SC-I FROM 1
% WHILE &DEFINED( &<&SCR>-FLD-<&SC-I>)
    % &VAR = &<&SCR>-FLD-<&SC-I>
% END

With this code.

% REPEAT VARYING &SC-I FROM 1
% WHILE &DEFINED( &<&SCR>-FLD-<&SC-I>)
    % &VAR= &DEFVAL
% END