The SOURCE keyword parses information about how the script was invoked, and what the script's name is. The source string contains the characters WIN32, followed by either COMMAND, FUNCTION, or SUBROUTINE, depending on whether the script was invoked as a host command (ie, directly launched by typing the name at a DOS command prompt, or launched by a Windows program that can start REXX scripts) or from a function call in an expression or using the CALL instruction. These two strings are followed by the complete path specification of the script.

Tokens are broken off at blank spaces, unless you specify a different search string after a token variable name.

Tokens can be thrown away by specifying a dot instead of a token variable name.

Tokens can be parsed by character position.

For example, if you start a script called "TEST.CMD" in the C:\Windows directory, from a DOS command line, and the script contains this line:

PARSE SOURCE token.1 token.2 token.3

then token.1 is "WIN32", token.2 is "COMMAND", and token.3 is "C:\WINDOWS\TEST.CMD".

NOTE: The SOURCE information can vary with different REXX interpreters. Reginald's format is as above.

NOTE: Reginald's 'OPTIONS OS' can give more specific information about which operating system version is being used.