8.60 EXEC (Execute a REXX script)

8.60.1 Function

The EXEC console command executes a Rexx script. EXEC invokes Rexx within the Hercules process to
execute the Rexx script and commands will be executed synchronously within the Hercules process.

The EXEC command is only available if Hercules is built with Rexx support (see the Hercules “Installation
Guide” for details on how to activate Rexx support and the Hercules “General Information” manual for
more details about the Rexx support). Chapter

14 (“ REXX Support ”) in this manual contains additional in-
formation about using Rexx with Hercules.

8.60.2 Syntax

Descriptive

[ ] rexx [argument [argument ...]]

Diagram

rexx ¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬§¬¬¬¬ÊÍ



«


~¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬®



¬¬ ¬¬



¬¬ ¬
argument ¬¬

8.60.3 Parameter

COMMAND

Specifies command style for passing arguments to a Rexx script. ‘COMMAND’ may
be abbreviated as ‘COM’. If not specified then the argument passing style is deter-
mined by the Rexx mode settings (form the REXX system parameter or console
command).

SUBROUTINE

Specifies subroutine style for passing arguments to a Rexx script. ‘SUBROUTINE’
may be abbreviated as ‘SUB’. If not specified then the argument passing style is
determined by the Rexx mode settings (form the REXX system parameter or con-
sole command).

rexx

This is the name (and optionally the path) of a Rexx script.

If the name of the Rexx to be executed is given without a pathname, the script is
searched within the path that has been defined with the REXX command or the de-
fault path if no path has been set for the Rexx environment (see the REXX console
command for more details).

If a path is specified in the EXEC command, then the Rexx will not be searched in
the defined path of the Rexx environment.

argument

These are the arguments (separated by spaces) to be passed to the Rexx script.

8.60.4 Examples

Example 1:

Execute Rexx script “testrexx.rexx” with arguments ‘arg1’, ‘arg2’ and ‘arg3’.

HHC00013I Herc command: 'exec testrexx arg1 arg2 arg3’

testrexx started

testrexx version . . . . : REXX-Regina_3.6(MT) 5.00 31 Dec 2011

testrexx source . . . . : WIN64 COMMAND d:\mvs\conf\testrexx.REX

testrexx hostenv . . . . : HERCULES

testrexx date . . . . . : 6 May 2012

testrexx time . . . . . : 02:39:19

testrexx arguments . . . : arg1 arg2 arg3

testrexx Hercules version : 3.08.0

testrexx RC environment . : D:\MVS\CONF\Hercules_Test.rc

HHC02208I Uptime 04:02:33

testrexx ended

Figure 124: EXEC command

The executed REXX script from example 1 is the following:

/* REXX */

parse arg parms

parms = space(parms)

argc = words(parms)

parse version ver

parse source src

env = address()

parse var src . . cmd

who = filespec("n",cmd)

parse var who who "." .

say who " started"

say who " version . . . . :" ver

say who " source . . . . :" src

say who " hostenv . . . . :" env

say who " date . . . . . :" date()

say who " time . . . . . :" time()

Previous Page Next Page