Some of my colleagues has made me aware that I do not have any tip about PARSE SOURCE in REXX. The PARSE command in REXX is a statement with a lot of functionality and one of the neglected possibilities certainly is PARSE SOURCE.
PARSE SOURCE returns a string of words about the execution of the REXX executing the PARSE SOURCE command. The following example shows what the command returns. I assume the REXX is called MYREXX, it was started using TSO MYREXX in ISPF and the member MYREXX is found using the SYSEXEC DD concatenation:
The typical output from the execution of the above REXX on the mainframe will look like this:
Invocation type will be either COMMAND, SUBROUTINE or FUNCTION. The environment type is either MVS, TSO or ISPF. The full description of PARSE is avaiable by clicking here. The real handy thing about PARSE SOURCE is of course its ability to tell you what the name of the actual executing REXX is. You may use this for many different purposes, but first and foremost to avoid hardcoding the REXX name in some REXX variable which you forget to change when you copy the same code to another REXX. Invocation type is also quite handy as it may be used to reject calls to a function made from the command line.