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
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.