A REXX program can use the function ADDRESS to detect the current environment. Following is a list of environments I know about (see Passing parameter to Rexx Dialog programs and Run a REXX program under a specific environment for examples for using this function.):
┌───────────────┬─────────────────────────┬───────────────────────────────────┐ │Return code of │Environment │Comments │ │ADDRESS │ │ │ └───────────────┴─────────────────────────┴───────────────────────────────────┘