The SYS$ERROR stream, which is equivalent to the UN*X standard error (stderr) stream, usually points to your terminal.
When a DCL procedure is invoked using /OUTPUT, SYS$ERROR points to the file specified. Similarly, when a DCL procedure is SUBMITted to batch, SYS$ERROR points to the batch job's log file (if any).
SYS$ERROR can be redirected using DEFINE (or ASSIGN). If DEFINEd in /USER mode, it will be DEASSIGNed when a program is run and that program terminates. If DEFINEd in /SUPERVISOR mode (the default if no access mode is specified in the DEFINE (or ASSIGN) command) or an “inner” (more privileged) mode, it remains in effect until explicitly DEASSIGNed.