CONSOLE – Issue z/OS console commands

Use the CONSOLE command to issue commands to the z/OS console.

CONSOLE <command>

Where <command> can be any valid REXX expression that resolves to a valid console command. For more details about REXX expressions and available functions, see TSO/E REXX Reference manual.

Subscripted variables can be used to issue a series of commands in a loop. For example, to issue a set of commands 10 seconds apart:
VARSUB SCAN (!)
VARSET CMD1 = "F WSIC,STATUS" 
VARSET CMD2 = "F WSJC,STATUS" 
VARSET CMD3 = "F WSKC,STATUS" 
VARSET CMD4 = "F WSLC,STATUS" 
DO X = 1 TO 4 
   CONSOLE @V(CMD!X) 
   WAIT 10 
END
The commands could be contained within a file and read into the process:
//RUNWAPL  EXEC EQQYXJPX, 
//         SUBSYS=WSLC 
//COMMANDS DD * 
F WSIC,STATUS 
F WSJC,STATUS 
F WSKC,STATUS 
F WSLC,STATUS 
//SYSIN    DD * 
VARSUB SCAN(!) 
READ COMMANDS OBJECT(CMDS) 
DO X = 1 TO !@CMDS 
   CONSOLE @V(@CMDS-!X.) 
END

To run the commands, ensure the you have the appropriate MCS console authority.

By default the console name will be the same as the job name. This can be altered by OPTIONS CONNAME.

After the command is issued, the process waits 2 seconds for the first messages to be issued, then waits up to 1 second for each subsequent message to be displayed. After one second passed with no new messages, the CONSOLE command completes. This can be altered by OPTIONS CONWAIT.

IEExxxs messages returned from issuing console commands typically have a severity of I but are mostly indicators of failure. To ensure errors are not missed all IEExxxI messages will be considered to be severity E. OPTIONS CONINFO allows IEExxxI message numbers to be provided to consider these IEExxxI messages to be considered as INFO level messages. OPTIONS CONWARN allows IEExxxI message numbers to be provided to consider these IEExxxI messages to be considered as WARNING level messages. Issue command SHOW OPTIONS to check the current setting of these options.

Any other messages retrieved will set return codes according to the message severity:

  • I and A return 0
  • W returns 4
  • Anything else returns 8