Purpose
Specifies an external program to execute when a variable is referenced or a function is called.
When Net.Data encounters an executable variable in a macro, it looks for the referenced executable program using the following method:
Authorization Tip: Ensure that the user ID under which Net.Data executes has access rights to any files referenced by the EXEC statement or block. See the section on specifying Web server access rights to Net.Data files in the configuration chapter of Net.Data Administration and Programming Guide for your operating system for more information.
The EXEC statement and block are used in two different contexts and have different syntax, depending where they are used. Use the EXEC statement in the DEFINE block, and use the EXEC block in the FUNCTION block.
Syntax
The EXEC statement syntax when used in the DEFINE block:
.-------------------------. V | >>-%EXEC------"----+-string-------------+--+---"--------------->< +-variable reference-+ '-function call------'
The EXEC block syntax when used in the FUNCTION block:
.-------------------------. V | >>-%EXEC------{----+-string-------------+--+---%}-------------->< +-variable reference-+ '-function call------'
Values
Context
The EXEC block or statement can be found in these contexts:
Restrictions
The EXEC block or statement can contain these elements:
The following Net.Data-provided language environments support the EXEC statement:
Examples
Example 1: Executable file referenced by a variable
%DEFINE mycall = %EXEC "MYEXEC.EXE $(empno)" %HTML (report){ <p>Here is the report you requested: <hr>$(mycall) %}
This example executes MYEXEC.EXE on every reference to the variable, mycall.
Example 2: Executable file referenced by a function
%FUNCTION(DTW_REXX) my_rexx_pgm(INOUT a, b, IN c, INOUT d){ %EXEC{ mypgm.cmd this is a test %} %}
This example executes mypgm.cmd when the function my_rexx_pgm is called.