IBM SC34-5764-01 Server User Manual


 
Chapter 21. REXX/CICS Command Definition
The REXX/CICS Command Definition Facility provides a means of easily defining (or redefining) REXX
commands and environments.
Background
One of the greatest strengths of REXX is its extendibility. You can write your own external functions,
subroutines, or commands to extend the capabilities of the REXX language. Because of this, one of the
natural uses for REXX is as an Application Integration platform. REXX/CICS provides you the ability to
seamlessly integrate your Line Of Business (LOB) application facilities, REXX language facilities, CICS
system facilities, and various software products into an integrated software platform.
The two main methods used to extend the REXX language, in order to add function, or to provide an
interface to an external facility or product, are:
v REXX External Functions (or subroutines)
v REXX Commands (sometimes called subcommands).
As an example to distinguish between the two, let's say we want to add the capability to REXX to sort a
REXX array. This could be accomplished, for example, by adding a sort function called ARRYSORT:
x = ARRYSORT(STEM1.)
This could likewise be accomplished by adding a REXX command called ARRYSORT:
'ARRYSORT STEM1.'
Note: In the above command example, it is not necessary to place quotes around the command. It is
however good coding practice to place single or double quotes around portions of command strings
that do not involve REXX variable substitution.
REXX external functions are traditionally used to extend the capabilities of the REXX language, whereas
REXX commands are traditionally used to interface to outside applications, products or system facilities.
However, either method is capable of being used either way.
Some major differences between REXX commands and external functions are:
v Functions always return a result, commands do not.
v Functions raise an error condition, commands always set a return code.
Highlights
The Command Definition Facility provides the capability to:
v Define new commands and environments easily, from a REXX exec.
v Share a common command environment with multiple independent developers.
v Write new REXX commands in the REXX language.
v Change command's implementation language transparently.
v Define authorized commands selectively.
v Redefine existing command names (without a code change).
Accomplishing Command Definition
You should use the DEFCMD command to perform basic command definitions that only affect your user
ID. A systems administrator or system programmer should use the DEFSCMD to perform system-wide
REXX/CICS command definitions. The DEFCMD and DEFSCMD commands are used from within a REXX
exec to define or change REXX command definitions. You can add or change your own command
definitions, using the DEFCMD command, without any special authorization. You must be a REXX/CICS
© Copyright IBM Corp. 1992, 2009 281