SYS$OUTPUT is a process-permanent logical name that refers to the default output device or file.
In an interactive process, the default value of SYS$OUTPUT is the terminal. In a command procedure run interactively, the default value of SYS$OUTPUT is the terminal. In a command procedure run in batch mode, the default value of SYS$OUTPUT is the batch job log file. When you log in, the system creates two logical names called SYS$OUTPUT. One name is created in executive mode; the other name is created in supervisor mode. You can supersede the supervisor mode logical name by redefining SYS$OUTPUT. If you deassign the supervisor mode name, the system redefines SYS$OUTPUT in supervisor mode, using the executive mode equivalence string. You cannot deassign the executive mode name. If the system cannot open the file you specify when you redefine SYS$OUTPUT, it displays an error message. After you redefine SYS$OUTPUT, most commands direct output to the existing version of the file. However, certain commands create a new version of the file before they write output.
You can redefine SYS$OUTPUT to redirect output from your default device to another file. When you redefine SYS$OUTPUT, the system opens a file with the name you specify in the logical name assignment. When you define SYS$OUTPUT, all subsequent output is directed to the new file. Remember to deassign SYS$OUTPUT. Otherwise, output will continue to be written to the file you specified. Note that you can redefine SYS$OUTPUT in user mode (with DEFINE/USER_MODE) to redirect output from an image. This definition is in effect only until the next command image is executed. Once the command image is executed (that is, the output is captured in a file), the logical name SYS$OUTPUT resumes its default value. In the following example, SYS$OUTPUT is redefined to a file for the duration of the SHOW PROCESS command:
SMAN43$ define/user sys$output proc.lis SMAN43$ show proc SMAN43$ type proc.lis 29-NOV-2019 07:26:41.55 User: DZELENINA Process ID: 28E00450 Node: SMAN43 Process name: "DZELENINA" Terminal: TNA19: (Host: 192.168.1.40 Locn: _FTA218:/FUND102) User Identifier: [WRITERS,DZELENINA] Base priority: 4 Default file spec: DSA1:[DZELENINA] Number of Kthreads: 1 (System-wide limit: 2) Devices allocated: TNA19:
You can also redirect output of a single command to a file using the PIPE command with this syntax:
PIPE command > file