Defined fields are typically part of report requests, but they can also be stored by themselves in a separate procedure to simplify maintenance, and to share with other users. If stored separately, there are two ways to incorporate defines into other report requests: using the EXECUTE or -INCLUDE command.
The EXECUTE Command
The EXECUTE command (EX) can be used to incorporate a fully executable procedure. For example, if you have a report request named 'MYDEFINE' that contains the commands to begin and end the define for your campus departments, you could execute that procedure in another report request named 'REPORT1'.
FOCEXEC: MYDEFINE
DEFINE FILE ac add
DEPT/A15=IF AC:agyunit eq '999100' then 'Business' else
if ac:agyunit eq '999200' then 'anthro' else
if ac:agyunit eq '999300' then 'admin' else '?';
END
|
FOCEXEC: report1
EX AC
EX mydefine
TABLE FILE AC
COUNT AC:position
BY dept
-* note: dept is created per mydefine
END
|
The -INCLUDE Command
The -INCLUDE command can be used to incorporate a partial procedure that can not be executed alone. For example, if you have a report request named 'MYDEFINE' that contains only the fieldname and expression to define your campus departments, you could include that procedure in another report request named 'REPORT1'.
FOCEXEC: MYDEFINE
DEPT/A15=IF AC:agyunit eq '999100' then 'Business' else
if ac:agyunit eq '999200' then 'anthro' else
if ac:agyunit eq '999300' then 'admin' else '?';
|
FOCEXEC: report1
EX AC
DEFINE FILE ac add
-INCLUDE mydefine
END
TABLE FILE AC
COUNT AC:position
BY dept
-* note: dept is created per mydefine
END
|
Refer to your FOCUS documentation for complete information on the EXECUTE and -INCLUDE commands.