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:

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: