Synopsis
This is an error in the way the REXX script is written. Some THEN keyword appears where it should not be.
Cause
You forgot to put an IF or a WHEN keyword before the THEN keyword.
Cure
THEN can't be used without a preceding IF or WHEN. Make sure that, for every THEN, there is one matching IF or WHEN before it (and no other THEN inbetween).
Cause
You tried to name a variable then in a place where a THEN keyword would be illegal.
Cure
In certain instructions, you cannot use the (unquoted) REXX keyword THEN for a variable name.