Skip to content

Latest commit

 

History

History
72 lines (64 loc) · 15.5 KB

USSCheatSheet.md

File metadata and controls

72 lines (64 loc) · 15.5 KB

UNIX System Services Cheat Sheet

The z/OS operating system has a Unix interface in addition to the traditional TSO interface. This Unix interface is called UNIX System Services, and is often abbreviated as USS. Details can be found here. Many z/OS systems programmers are unused to working in the Unix shell and have a hard time navigating it. Additionally, the default shell on USS is not a bash shell, so help provided by traditional Unix users is sometimes deceptive.

The Unix philosophy is important to take to heart when using z/OS UNIX, and is summarized succinctly: The Unix philosophy emphasizes building simple, short, clear, modular, and extensible code that can be easily maintained and repurposed by developers other than its creators.

This page is intended to provide z/OS Systems Programmers (aka sysprogs) a cheat sheet that they can use to do most of the tasks they would need to accomplish on z/OS UNIX. Contributions come from sysprogs in multiple companies.

Clicking on the command will take you to detailed documentation of that particular command. Details for all commands can be found in the UNIX System Services Command Reference.

man command will also give you more information and (often) examples of usage.

z/OS UNIX Command Description
amblist "//'MY.LOAD.PDS'" <<< " LISTLOAD MEMBER=MYMEMBER" > filename.amblist Generate an AMBLIST for a load module member and store the generated AMBLIST in filename.amblist.
cat filename cat displays and concatenates files. It copies each file argument to the standard output (stdout).
cat -Wfilecodeset=IBM-1047 filename Use specific code page for cat
chmod +x filename Make a file executable.
chtag -t -c IBM-1047 filename Tag filename as an EBCIDIC. The chtag allows you to tell z/OS how the file is encoded.
chtag -t -c ISO8859-1 filename Tag filename as an ASCII file. The chtag allows you to tell z/OS how the file is encoded.
chtag -r filename Untag filename.
dcp MY.TEXT.PDS /absolute/path Copy plain text members (i.e. source code) from a PDS to to a folder on ZFS. (Requires ZOAU)
dcp /absolute/path/* MY.TEXT.PDS Copy plain text files (i.e. source code) from a ZFS folder to to a PDS. (Requires ZOAU)
dcp -B MY.OBJ.PDS /absolute/path Copy binary object members (OBJs) from a PDS to to a folder on ZFS. (Requires ZOAU)
dcp -B /absolute/path/* MY.OBJ.PDS Copy binary object files (OBJs) from a ZFS folder to to a PDS. (Requires ZOAU)
dcp -X MY.LOAD.PDS /absolute/path Copy link edited/executable binary members (LOAD modules) from a PDS to to a folder on ZFS. (Requires ZOAU)
dcp -X /absolute/path/* MY.LOAD.PDS Copy link edited/executable binary files (LOAD modules) from a ZFS folder to to a PDS. (Requires ZOAU)
ddiff MY.DATASET1 MY.DATASET2 Compare two datasets. Retruns 0 when both datasets are identical. Returns 1 and displays the difference between the two datasets when they are not identical. (Requires ZOAU)
df -kP Display free space in all mounted filesystems. -k makes sure units are in 1KB increments instead of 512 byte increments. -P shows the percentage of each filesystem that is used.
df -kP . Display free space in the filesystem that the present working directory is mounted to. -k makes sure units are in 1KB increments instead of 512 byte increments. -P shows the percentage of the filesystem that is used.
df -kP path Display free space in a specific file system. -k makes sure units are in 1KB increments instead of 512 byte increments. -P shows the percentage of the filesystem that is used. path is any valid path. File system usage will be displayed for the filesystem the path is mounted to.
dls MY.HLQ.* List non-VSAM datasets that match a pattern. (Requires ZOAU)
dls -s MY.HLQ.* List non-VSAM datasets that match a pattern along with the following properties for each dataset listed: [storage class, record format, logical record length, volume serial, estimate of allocated disk space used in bytes, allocated disk space in bytes] (Requires ZOAU)
dmv MY.ORIG.DATASET MY.NEW.DATASET Rename a dataset. (Requires ZOAU)
drm MY.DATASET Delete a dataset. (Requires ZOAU)
dtouch -b directory blocks -r U -c PO -s primarycylinders(K/KB, M/MB, G/GB, C/CYL, T/TRK) -e secondarycylinders(K/KB, M/MB, G/GB, C/CYL, T/TRK) MY.LOAD.PDS Allocate a PDSE dataset for link edited/executable binary objects (LOAD modules). (Requires ZOAU)
dtouch -c PO -s primarycylinders(K/KB, M/MB, G/GB, C/CYL, T/TRK) -e secondarycylinders(K/KB, M/MB, G/GB, C/CYL, T/TRK) MY.OBJ.PDS Allocate a PDSE dataset for binary objects (OBJS). (Requires ZOAU)
dtouch -c PO -s primarycylinders(K/KB, M/MB, G/GB, C/CYL, T/TRK) -e secondarycylinders(K/KB, M/MB, G/GB, C/CYL, T/TRK) MY.MACRO.PDS Allocate a PDSE dataset for (MACROS). (Requires ZOAU)
dtouch -l 133 -r FBA -c PO -s primarycylinders(K/KB, M/MB, G/GB, C/CYL, T/TRK) -e secondarycylinders(K/KB, M/MB, G/GB, C/CYL, T/TRK) MY.LISTING.PDS Allocate a PDSE dataset for the metadata assocatiated with compiled binary objects (LISTINGS). (Requires ZOAU)
du -ks folderorfilesame Display how much disk space in kilobytes a folder or file takes up.
extattr +a filename Change attributes of the file filename to make it APF authorized. Other attributes could be set as well.
find / -name filename 2>/dev/null Look in the file system for filename starting in the root. if you come across an error (like Permission Denied) throw it away.
find . -type f | xargs grep pattern A way to recursively search for files that contain a specific pattern. On other platforms also known as grep -r
grep Search a file or stdin for a specified pattern. This can be useful for searching within long command output, by piping another command's stdout into grep.
iconv -l Show encoding schemes that are supported on z/OS UNIX.
iconv -T -f originalencoding -t newencoding originalfile > newfile Convert the bytes contained in a file to a new encoding and write the converted bytes to a new file that is tagged according to the new encoding.
kill -9 processnumber Kill (end) the process identified by processnumber. Great for runaway processes
ls -lta List the files in the current directory -l makes sure it shows data like permissions, -t sorts by time and -a shows . info
ls -ET List the files in the current directory -E shows extended attributes (like APF authorization) and T shows file tagging (is it ASCII, EBCDIC, or Binary)
md5 filename Generate a file's MD5 checksum hash and print the generated checksum to the console.
md5 "//'MY.PDS(MEMBER)'" Generate a dataset member's MD5 checksum hash and print the generated checksum to the console.
mkdir Create a directory. The file system is hierarchical. This will create a directory in the current directory.
mls MY.PDS List PDS members. Note that the member list displayed does not include alias members. (Requires ZOAU)
mmv MY.PDS ORIG NEW Rename a PDS member. (Requires ZOAU)
mrm MY.PDS(MEMBER) Delete a PDS member. (Requires ZOAU)
mvscmd --pgm=IEBCOPY --sysprint=stdout --in=MY.INITIAL.DATASET --out=MY.TARGET.DATASET --sysin=stdin <<zz\n        COPYGRP INDD=IN,OUTDD=OUT\nzz Use IEBCOPY to copy the contents of one dataset to another dataset. The target dataset must already be allocated. (Requires ZOAU)
opercmd "OPERATOR-COMMAND" Issue a z/OS operator command. May fail without sufficient authority. (Requires ZOAU)
ps -ef Return the status of all of the processes known by USS
pwd displays the absolute path name of the working directory to standard output
rm * Remove a file. With the * it will remove all of the files in the current directory
rm -R * Remove all of the files in this directory and recurse down any directories and remove files from them too
sha1 filename Generate a file's SHA1 checksum hash and print the generated checksum to the console.
sha1 "//'MY.PDS(MEMBER)'" Generate a dataset member's SHA1 checksum hash and print the generated checksum to the console.
sha256 filename Generate a file's SHA256 checksum hash and print the generated checksum to the console.
sha256 "//'MY.PDS(MEMBER)'" Generate a dataset member's SHA256 checksum hash and print the generated checksum to the console.
sysvar SYSNAME Display the system name.
tso "CALL 'MY.PDS(MEMBER)'" Call/execute a load module member.
tso "RENAME 'MY.PDS(REALMEMBER)' (ALIASMEMBER) ALIAS" Create an alias of a dataset member.
tsocmd "LISTDS 'MY.PDS' MEMBERS" List the members of a PDS and show dataset member aliases.
type name Show the location of the executable known as name. Very useful when you want to make sure you are executing the right code.