z/OS command collection

In the not so far past, I spent a lot of my time working with and configuring z/OS or MVS mainframes. Over time, I managed to collect a serious collection of useful MVS-commands. Most of these commands can just be found in the forests of IBM documentation but the keyword in my previous sentence is “useful”. I found it, even as a person who was working for years in z/OS environments always difficult to get the right command for a certain action. The lack of examples and over-theoretical explanations made it, at least for me, not very accessible.

Part 1: MVS commands

Most commands under here can be executed from a console, either a real console or via the HMC. On z/OS, the commands can be executed from the SDSF command line. To execute the commands on a normal console, there is not need to enter the first slash. When executing from SDSF, we need to tell that we want to execute an MVS-command and need to enter the preceding /. In SDSF, you can recall your last used commands by just typing a /.

JES2-commands

JES is the Job Entry Subsystem which is responsible for scheduling, executing and output-related taks regarding jobs on the machine. These commands are mainly job and initiator related.

Command Action
/$d a Display all active jobs (started tasks, batch jobs and TSO-users)
/$dj(jobname) Display information about jobs with a certain name
/$cj(jobid) Cancel a job with a specific jobid
/$aj(jobid) Activate a job with a specific jobid that was put on hold (TYPRUN=HOLD in the jobcard)
/$pi Drain (=stop when free) all initiators
/$pi [x] Drain (=stop when free) one specific initiator x
/$pi [x-y] Drain (=stop when free) a range of initiators, from x to y
/$si Start all initiators
/$si [x] Start one specific initator x
/$si [x-y] Start a range of initiators, from x to y
/$di Display the status of all initiators
/$di [x] Display the status of one initiator x
/$di [x-y] Display the status of a range of initiators, from x to y
/$da,t Display the active (TSO) users
/$da,x Show the active tasks
/$d spl,all Show the status of the spool (volumes and percent utilization)
/$o jobq,*,all,cancel,a>(days) Remove entries from the spool that are older than days
/$pJES2 Stop JES2
/$pJES2,abend Force stop JES2

Job and STC related commands

These commands are used to take basic actions on jobs and started tasks. A lot of these commands can be done directly from JES2.

Command Action
/d r,l Show open messages on the console (if they scrolled away)
/d r,r Show open requests. These are waiting for a reply with XX,
/d j,(jobname) Get more information about a certain job or started taks
/p <stc> Purge an address space
/s <stc> Start address space (from the proclib)
/f <stc>,<option> Modify address space with a certain option (depends on the address space)
/d grs,res=(*,'(dataset)') Check which job is using a certain dataset. For example when the you get a dataset in use message

Console control

The following commands are mainly used to control the behavior of a console. Most of them are not relevant when entering MVS-commands via SDSF but are to be used with a real or emulated console (not via HMC).

Command Action
/vary cn(*),activate Activate the console
/v xxx,console Activate a console on a certain device (xxx=address)
/d c Show defined consoles
/k s Show console settings (for example enable roll DEL=RD)
/k a,none Delete the out of line messages (if this fails try /k e,d first)
/k a,11,4 Enable display area (a fixed and scrolling part) 11=bottom part, 4=top part
/k e Clear the console (top part)
/k e,d Clear console display area (bottom part)
/k d,f Continue scrolling in the display area (bottom part)

System-related

These commands are system related, they give or set information regarding general system configuration or information regarding IPL and authorized datasets.

Command Action
/d iplinfo Show the last IPL time, IODF and IEASYS information
/d u,iplvol Show the volume used for IPL
/d m Show machine CPU-information,  machine serial and MIFID
/d prod,registered Show the version of z/OS components
/d parmlib Show which parmlib was used during IPL
/set prog=00 Refresh APF using sys1.parmlib(prog00)
/d prog,apf Show the APF-authorized datasets
/d prog,exit Show installed exits
/d prog,lnklst Show the datasets in the linklist
/d sms Show the location of the SCDS and ACDS
/f lla,refresh Refresh LLA
/d asm[,all] Show the status of (all) page-datasets
/pa page=xx.yy.zz Add page dataset with name xx.yy.zz
/z eod End of Day
/T CLOCK=15.25.00 Dynamically change the clock

Slip traps, logging, dumps and tracing

The next set of commands is related to tracing and troubleshooting with Serviceability Level Indication Processing or SMF.

Command Action
/d slip[=slip id] Show more details about a specific slip trap
/d slip Show or list all slip traps
/slip mod,enable,id=(slip id) (Re-)activate a specific slip trap
/slip mod,disable,id=(slip id) Disable a slip trap
/slip set Add a slip trap. For example: slip set,ID=TWSS,ENABLE,msgid=EQQE024I,ACTION=SVCD,JOBNAME=TWSS,SDATA=(ALLPSA,PSA,SQA,LSQA,RGN,LPA,TRT,SWA,SUMDUMP,ALLNUC,GRSQ),end
/d trace Status of the System Trace Table
/trace st,xxxK Enlarge and enable the System Trace Table (default: 256K)
/trace st,off Disable System Trace
/d smf Show the status of the SMF dump datasets
/s smfdump,da=xx.yy.zz Start an SMF-dump for a certain dataset xx.yy.zz
/i smf Swith the active SMF dataset

VTAM

VTAM is the (legacy) networking system that was providing SNA. Today it is still an important part in the communication between multiple LPAR’s or machines. For example to access applications running on another node you will need to dive into the VTAM configuration.

Command Action
/d net,vtamopts Show the options used to start VTAM (for example CONFIG=?? & LIST=??)
/d net,majnodes Show the active VTAM major nodes
/d net,id=<majnode>,e Show the minor nodes and their status in the major node
/d net,ee Show an overview of the Enterprise Extender related settings
/d net,aping,id=?? Do a VTAM-ping to a certain ID
/d net,route,destsub=?? Show the route used to contact a certain subarea
/V net,act,id=?? Activate a VTAM resource (defined in a member in VTAMLST)
/v net,act,id=<xca min>,logon=<appl> Change the logon application for a certain minor node
/v net,act,id=<xca mjn>,update=all Dynamical update of an active XCA major node (z/OS>1.8)
/v net,inact,id=?? Desactivate a VTAM resource
/v net,dial,id=<switched majnode> Activate a switched major node
/v net,hangup,id=<switched majnode> Desactivate a switched major node
/s vtam,,,(list=xx) Start VTAM with another ATCSTRxx member

TCP/IP

Next to VTAM, TCP/IP is the most important component responsible for communication on z/OS. Most of these commands are related to IP-addresses and OSA devices.

Command Action
/d tcpip,tcpip,netstat,home Show the IP configuration (IP addresses and links)
/d tcpip,,n,dev Show the status of the network devices (OSA)
/d tcpip,,n,route Show the routing table
/d tcpip,,n,stats Show TCP/IP statistics (counters, error-rate,…)
/d tcpip,,n,stats,protocol=UDP Show UDP statistics
/v tcpip,tcpip,obeyfile,dsn=<DSN> Dynamically activate an extra TCP/IP configuration
/V tcpip,tcpip,stop,<devicename> Stop an OSA-device (use the name listed with netstat,dev)
/V tcpip,tcpip,start,<devicename> Start an OSA-device (use the name listed with netstat,dev)
/q osa active/all Show the status of all OSA cards
/f resolver,refresh Reload the DNS configuration

Hardware

The commands under here provide information that is hardware related or can be used to activate and deactivate hardware-related objects like devices, CHPID’s or control units.

Command Action
/ds qd,vol=<volser> Find out the device address of a volser (volume name)
/d u,vol=<volser> Find out the device address of a volser (volume name)
/d u,,,<address>,<num> Show basic information for a <num> of devices starting with address <address>
/d u,,alloc,<address>,<num> List what is allocated on a range of DASD
/f catalog,restart Restart the catalog (requires a reply which causes problems in SFSF)
/d u,dasd,online List the DASD devices that are online
/d m=dev(<address>) Show information about a device with address <address>
/d m=chp(<chpid>)  Show information about a CHPID <chpid>
/d m=cu(<control unit>) Show information about a Control Unit <control unit>
/d m=cpu Show CPU-related information
/cf chp(xx),offline(,force) Put a CHPID xx offline (optionally force it offline)
/cf chp(xx),online(,force) Put a CHPID xx online (optionally force it online)
/v <address>,online(,force) Put a device with address <address> online  (optionally force it online)
/v <address>,offline Put a device with address <address> offline
/v <address>,online,uncond Put a boxed device online with address <address>
/v path(devzz,chpxx),offline Put a path to device devzz from CHPID chpxx offline
/v path(devzz,chpxx),online Put a path to device devzz from CHPID chpxx online
/v path((devzz-devyy),chpxx),online Put a path of a range of devices online
/v path((devzz-devyy),chpxx),offline Put a path of a range of devices offline
/d xcf,pi Show XCF/sysplex path-in-addresses
/d xcf,po Show XCF/sysplex path-out-addresses

TSO

These commands are related to controlling the TSO address space or TSO-users.

Command Action
/c u=<userid> Cancel a user that is logged on
/d ts Show the max number of users (usermax), number of inits and the current number of users logged on
/f tso,usermax=1 Change the max number of users allowed in TSO
/se '<message>',user=<tso-user> Send a message to a specific TSO-user
/se '<message>',logon Broadcast a message to all TSO users that are logged on

Various

Various commands that don’t really fit in one of the above categories, mainly related to controlling other subsystems.

Command Action
/#stop Stop RACF (# depends on the RACF prefix, default prefix=#, can be checked in parmlib-member IEFSSNxx)
/stop acf2" Stop ACF2
/+dis utility(*) Display open utils in DB2 (+ depends on the DB2 prefix, can be checked in parmlib-member IEFSSNxx: INITPARM('DSN3EPX,+,S'))
/f db2x,thpl kill id=(sessionid) Kill a DB2 thread
/+stop db2 mode(force) Force stop DB2  (+ depends on the DB2 prefix, can be checked in parmlib-member IEFSSNxx: INITPARM('DSN3EPX,+,S'))
/f tsa,INGLIST */APL/*,COMPOUND=^SATISFACTORY Show all TSA controlled subsystems that aren't having the correct status
/F cics1,CEMT P SHUT Stop CICS address space
/f twsc,rfrdest Refresh TWS destinations (ROUTOPTS). TWSC=TWS controller address space
/f twsc,dspdest Show TWS destinations (ROUTOPTS). TWSC=TWS controller address space
/f twsc,rfruser Refresh TWS users

Part 2: TSO commands

The commands under here can be used from within TSO. Most of them can be entered directly on the TSO command line by using the prefix tso. Otherwise, they can be entered via the command option (by default option 6 on the Primary Options Panel).

USS

Unix System Services or OMVS-related commands

Command Action
MOUNT FILESYSTEM('/tmp') TYPE(TFS) MOUNTPOINT('/SYSTEM/tmp') PARM('-s 4000') Mount an in-memory filesystem of 4GB to mountpoint /mnt

RACF

RACF is the standard security component on z/OS

Command Action
RDEFINE TSOPROC PROCNAME UACC(READ) Define a new TSO procedure
SETROPTS RACLIST(TSOPROC) REFRESH Refresh the TSOPROC class
ADDUSER <username> DFLTGRP(SYS1) OWNER(SYS1) PASSWORD(<password>) NAME('002') AUTHORITY(USE) UACC(READ) TSO(ACCTNUM(ACCT#) PROC(TSOUSR) SIZE(2500) MAXSIZE(15000)) OPERATIONS Example to add a RACF user and allow the user to login to the system

ISPF

ISPF-related commands

Command Action
panelid Show panel names
sarea Show more information about the system
hlist dsn(/) mcds ter Use as a line command to get to know the size of a migrated dataset without recalling it
delete X all Edit/view command to delete all excluded lines
tso isrddn Show datasets allocated to ISPF
tso isrfind Search for members in the ISPF-allocation

Hopefully, the above list can help some people in order to solve their daily struggles. I do realize that the list is far from complete and would, in a lot of cases, need some more explanation to clearly show what it’s doing. Nevertheless, this list really helped me out in a lot of difficult situations.

5 thoughts on “z/OS command collection

  1. It is a very good collection of “useful” z/OS commands. Thanks! I appreciate your time and efforts put in to prepare this list.

  2. Is there any command to check who is using a particular device in Mainframe?
    Ex: If X is using device E00.
    How to check, who is X?

Leave a Reply

Your email address will not be published. Required fields are marked *