TSO Commands
The TSO Commands on Mainframe is an important topic which every Mainframe Developer must master.
TSO Mainframe Commands
TSO ALLOCATE Mainframe Command
The ALLOCATE Command in TSO is used for allocating a PS or PDS file. ALLOCATE can be used for PDS, PDS member, GDG, Temporary dataset, similar new dataset, PS, PDSE etc.
Let us see some important TSO ALLOCATE Command Examples –
ALLOCATE DATASET(ALLOC.FILE1) NEW DIR(4) TRACKS SPACE(2,3) DSORG(PO) RECFM(F) LRECL(80) BLKSIZE(800) CATALOG ALLOC DA(ALLOC.FILE2) DSORG(PS) SPACE(2,0) TRACKS LRECL(80) BLKSIZE(800) RECFM(F,B) NEW ALLOC DA(ALLOC.FILE3) SPACE(4,5) TRACKS LIKE(ALLOC.FILE2)
Explanation of the examples
You will see 3 examples for TSO ALLOCATE command.
- In this first example, we are trying to allocate a new PDS with name ‘ALLOC.FILE1’.
- In the Second example, we are allocating a new PS file.
- This example is trying to allocate a new file ‘ALLOC.FILE3’ which has similar properties as the file ‘ALLOC.FILE2’ with a different space parameter which is 4 for primary and 2 for secondary.
TSO REFRESH Command
TSO REFRESH command is used to refresh a data-list.
If you are in option 3.4(which is DSLIST), then you can simply type ‘REF’ which is the shorthand of ‘REFRESH’.
Note:
You can try this command for inside a PDS, PDS member, PS file, Dataset list etc. There is no need to go to option 6(Enter TSO or Workstation Commands).
Browse a dataset
If you want to browse a file, you need to give ‘B’ in front of a dataset in DSLIST.
EDIT a dataset
If you want to edit a dataset, you need to give ‘E’ in front of a dataset in DSLIST.
TSO CREATE command
There are multiple ways to create datasets in Mainframe like –
- You can use option 3.2 to create a dataset.
- Use TSO CREATE command to create a dataset.
- Copy the content of one dataset to another dataset through ‘COPY’ command.
Let us see how we can do it with ‘TSO CREATE’ COMMAND.
Suppose you are in Browse, View or Edit mode in a file and you want to create a new dataset from inside another dataset. Then you follow these Commands.
a) CREATE .ZF .ZL
b) Give the name of the new dataset and file allocation option as either option 1 or option 2.
TSO command to copy the contents of one dataset to another dataset
Suppose you have a dataset with name ‘FILE1’ and you want to copy the content of entire dataset i.e. ‘FILE1’ to another file say, ‘FILE2’, then you can give the command.
a) Go to ‘FILE1’ and issue a command ‘CUT A’ in the command line.
b) Go to ‘FILE2’ and issue a command ‘PASTE A’ in the command line.
TSO DELETE command
If you want to delete a dataset, you can issue a command –
TSO DELETE ‘DATASET-NAME’
Here, DATASET-NAME is the name of the dataset which you want to delete.
Note:
You must give the ‘DATASET-NAME’ within the quotation mark.
For example, TSO DELETE DATASET-NAME is wrong. It must be TSO DELETE ‘DATASET-NAME’.
TSO DSLIST command
Suppose, you do not want to go to option 3.4(i.e. DSLIST) but you want to open the dataset directly from option 6(Enter TSO or Workstation commands) from ISPF Primary Option Menu –
DSLIST ‘DATASET-NAME’
Here, DATASET-NAME is the name of the dataset which you want to list.
For Example – DSLIST ‘MATELS.TSO.FILE’
TSO command for KeyList
If you want to see all the keylist from option 6(Enter TSO or Workstation commands) from ISPF Primary Option Menu –
KEYLIST
Here, you will get all the keylists which are available. It contains private and shared keylist.
TSO command for KEYS
If you want to see all the Functional Keys from option 6(Enter TSO or Workstation commands) from ISPF Primary Option Menu –
KEYS
Note: You can edit the values in KEYS as well. Keys are used to mapping the functional keys from the keyboard of the computer with the Definition available in Mainframe.
For Example – If you want to make sure, that if you press F2 in your keyboard and in the Mainframe screen, it should open ‘HELP’ then you have to type ‘HELP’ under the definition for the key F2 in KEYS.
TSO Command to display the message by the system operator
If you want to see the message sent by the system operator then you can go to option 6(Enter TSO or Workstation commands) from ISPF Primary Option Menu and type –
LISTBC
If there is any message by your system administrator, then it will show that message else you will get a default message ‘ …NO BROADCAST MESSAGES’
TSO Command to quickly list the short details of a dataset
If you want to list the record format, logical record length, block size and dataset organization of a particular dataset then you can go to option 6(Enter TSO or Workstation commands) from ISPF Primary Option Menu and type –
LISTDS ‘NAME-OF-DATASET’
Here, ‘NAME-OF-DATASET’ is the dataset for which you want to see the details.
TSO Command to list all the datasets present in your catalog
If you want to list all the datasets which are present in your catalog table then you can go to option 6(Enter TSO or Workstation commands) from ISPF Primary Option Menu and type –
LISTCAT