Sometimes, it may be useful to know which REXX interpreter is running your script, because there are some differences in interpreters. For example, some interpreters may not have certain built-in functions.

The PARSE VERSION keywords parse information about the REXX interpreter, the REXX language version\level, and date of the interpreter. This consists of five words (separated by blanks). The first word is "REXX-", followed immediately by the interpreter name and its release/version number in the form "REXX-name_version". name is the name of the REXX interpreter, and version is the version/revision of the interpreter, for example, REXX-Reginald_1.0.

The second word is the REXX language level. "4.00" is the latest version of the REXX language. Earlier versions are likely to not support extra built-in functions or features such as LINES() modes.

The last three words are the release date of the interpreter (ie, "13 Aug 2001").

You should parse this information by words rather than by character position, as the language version/level could be different lengths for various versions.

/* Display information about the interpreter */

/* Get the 5 words (information) into 3 separate variables */
PARSE VERSION name level date
date = STRIP(date)

/* If the name begins with "REXX-", then trim that off */
IF LEFT(name, 5) == "REXX-" THEN DO

   /* Separate the interpreter name and version */
   PARSE VAR name "REXX-" name "_" version

END

/* Must be a non-standard PARSE VERSION format */
ELSE version = "Unknown"

SAY "Interpreter name:" name
SAY "Interpreter version:" version
SAY "REXX language support:" level
SAY "Interpreter date:" date

RETURN