Progress0 of 0 lessons

Essential TSO Commands Every User Should Know

Mastering essential TSO commands is fundamental to effective mainframe work. These commands provide the core functionality you need for daily operations: managing datasets, submitting jobs, communicating, and managing your session. This tutorial covers the most important TSO commands that every mainframe user should know: ALLOCATE, FREE, LISTCAT, DELETE, SEND, RECEIVE, SUBMIT, FIND, PROFILE, LOGOFF, and HELP.

These commands form the foundation of TSO usage. While ISPF provides menu-driven interfaces for many operations, understanding these TSO commands gives you flexibility, enables scripting and automation, and helps you work more efficiently. Many of these commands are also available within ISPF, but knowing the TSO command syntax allows you to use them in scripts, CLISTs, and REXX execs.

ALLOCATE Command

The ALLOCATE command allocates a dataset to a DD (Data Definition) name, making it available for use by programs or TSO commands. Allocation is essential for making datasets accessible to applications and is one of the most frequently used TSO commands.

Basic ALLOCATE Syntax

The basic syntax for ALLOCATE is:

text
1
ALLOCATE FILE(DDNAME) DATASET('DSNAME')

Where:

  • FILE(DDNAME) specifies the DD name (Data Definition name) to assign to the dataset. DD names are used by programs to reference datasets.
  • DATASET('DSNAME') specifies the dataset name to allocate. The dataset name is typically quoted.

ALLOCATE Options

ALLOCATE supports many options that control how the dataset is allocated:

  • SHR: Allocates the dataset for shared access, allowing multiple users or jobs to access it simultaneously. This is the most common option for read operations.
  • OLD: Allocates the dataset for exclusive access. Only one user or job can access it, and others are blocked until the allocation is freed. Use OLD when you need exclusive access for writing.
  • NEW: Allocates a new dataset. Use this when creating a new dataset rather than accessing an existing one.
  • MOD: Opens the dataset in modification mode, allowing you to append to it.
  • REUSE: Allows reusing an existing allocation if the DD name is already allocated.

ALLOCATE Examples

Here are examples of ALLOCATE commands:

text
1
ALLOCATE FILE(INPUT) DATASET('USERID.SOURCE.COBOL') SHR

This allocates a dataset for shared read access.

text
1
ALLOCATE FILE(OUTPUT) DATASET('USERID.OUTPUT.DATA') OLD

This allocates a dataset for exclusive write access.

FREE Command

The FREE command releases an allocation, freeing the DD name and making it available for other uses. After freeing an allocation, the dataset is no longer associated with that DD name.

Basic FREE Syntax

The basic syntax for FREE is:

text
1
FREE FILE(DDNAME)

Or to free all allocations:

text
1
FREE ALL

When to Use FREE

Use FREE when:

  • You're done using an allocated dataset and want to release the allocation.
  • You need to free a DD name for a different allocation.
  • You want to clean up allocations before ending your session.
  • An allocation is no longer needed and you want to release system resources.

While allocations are automatically freed when you log off, it's good practice to explicitly free allocations when you're done with them, especially in scripts or long-running sessions.

LISTCAT Command

The LISTCAT command lists catalog entries, showing datasets and their attributes. LISTCAT is essential for finding datasets, checking their existence, and viewing their attributes.

Basic LISTCAT Syntax

To list all your datasets:

text
1
LISTCAT

To list a specific dataset:

text
1
LISTCAT ENT('USERID.SOURCE.COBOL')

LISTCAT Options

LISTCAT supports various options:

  • ENT('DSNAME'): Lists a specific dataset entry.
  • LEVEL('highlevel'): Lists all datasets with a specific high-level qualifier.
  • ALL: Lists all catalog entries (may be restricted by security).

LISTCAT Output

LISTCAT displays information including:

  • Dataset names
  • Dataset organization (PS, PDS, PDSE, etc.)
  • Record format (RECFM)
  • Record length (LRECL)
  • Block size (BLKSIZE)
  • Volume information
  • Catalog status

DELETE Command

The DELETE command deletes datasets or members from the system. DELETE permanently removes data, so use it carefully.

Basic DELETE Syntax

To delete a dataset:

text
1
DELETE 'USERID.OLD.DATA'

To delete a member from a PDS:

text
1
DELETE 'USERID.SOURCE.COBOL(MEMBER1)'

DELETE Options

DELETE supports options like:

  • NOSCRATCH: Removes the dataset from the catalog but doesn't scratch it from the volume (advanced option).
  • PURGE: Permanently deletes the dataset, bypassing retention periods.

DELETE Safety

Important considerations when using DELETE:

  • DELETE is permanent—deleted datasets cannot be easily recovered.
  • Some systems may require confirmation before deletion.
  • Security systems may restrict who can delete certain datasets.
  • Always verify the dataset name before deleting.
  • Consider backing up important data before deletion.

SEND Command

The SEND command sends messages to other TSO users or your own terminal. SEND is useful for communication and notifications.

Basic SEND Syntax

To send a message to another user:

text
1
SEND 'message text' USER(userid)

To send a message to your own terminal:

text
1
SEND 'message text'

SEND Use Cases

SEND is useful for:

  • Notifying other users about completed jobs or tasks
  • Sending reminders or alerts
  • Communicating with team members
  • Creating notifications in scripts

RECEIVE Command

The RECEIVE command receives messages sent to you via SEND. RECEIVE displays messages that have been sent to your userid.

Basic RECEIVE Syntax

To receive and display messages:

text
1
RECEIVE

RECEIVE Options

RECEIVE may support options like:

  • Displaying all pending messages
  • Deleting messages after display
  • Keeping messages for later review

SUBMIT Command

The SUBMIT command submits batch jobs for execution. SUBMIT is essential for running programs, compiling code, and performing batch operations.

Basic SUBMIT Syntax

To submit a JCL job:

text
1
SUBMIT 'USERID.JCL.JOB(MEMBER1)'

Or for a sequential dataset:

text
1
SUBMIT 'USERID.JCL.JOB'

SUBMIT Output

SUBMIT typically returns:

  • A job number (JOBnnnnn) that identifies the submitted job
  • Confirmation that the job was submitted
  • Any immediate errors if the submission failed

After SUBMIT

After submitting a job:

  • The job is queued for execution
  • You can check job status using system utilities
  • Job output is available after the job completes
  • You can continue working while the job runs in the background

FIND Command

The FIND command searches for text within datasets. FIND is useful for locating specific information in files.

Basic FIND Syntax

To find text in a dataset:

text
1
FIND 'searchtext' 'USERID.SOURCE.COBOL'

FIND Options

FIND may support options like:

  • Case-sensitive or case-insensitive search
  • Searching within specific members of a PDS
  • Displaying context around matches
  • Counting occurrences

PROFILE Command

The PROFILE command manages your TSO profile settings. PROFILE allows you to view and modify your personal TSO configuration.

Basic PROFILE Syntax

To view your profile:

text
1
PROFILE LIST

To set a profile option:

text
1
PROFILE PREFIX(USERID.DATA)

PROFILE Options

PROFILE can set various options including:

  • Default dataset prefix
  • Terminal characteristics
  • Command processing options
  • Session parameters

LOGOFF Command

The LOGOFF command ends your TSO session, properly closing all allocations, releasing resources, and terminating your connection.

Basic LOGOFF Syntax

To log off:

text
1
LOGOFF

What LOGOFF Does

LOGOFF:

  • Closes all allocated datasets
  • Releases system resources
  • Saves your profile if modified
  • Terminates your session
  • Displays a logoff message

Always Use LOGOFF

Always use LOGOFF to end your session rather than just closing your terminal emulator. LOGOFF ensures proper cleanup and resource release.

HELP Command

The HELP command displays help information for TSO commands. HELP is invaluable for learning commands and checking syntax.

Basic HELP Syntax

To get help for a command:

text
1
HELP commandname

For example:

text
1
HELP ALLOCATE

HELP Information

HELP typically provides:

  • Command syntax
  • Parameter descriptions
  • Usage examples
  • Related commands
  • Notes and restrictions

Best Practices for Using Essential Commands

Following best practices helps you use these commands effectively:

  • Use HELP: When unsure about a command, use HELP to check syntax and options.
  • Free Allocations: Free allocations when done to release resources.
  • Verify Before DELETE: Always verify dataset names before using DELETE.
  • Use LOGOFF: Always use LOGOFF to properly end sessions.
  • Check SUBMIT Results: Verify job submission was successful and note job numbers.
  • Practice Safety: Be cautious with commands that modify or delete data.
  • Learn Abbreviations: Many commands can be abbreviated to save typing.
  • Combine with ISPF: Use these commands in combination with ISPF for maximum efficiency.

Explain Like I'm 5: Essential TSO Commands

Think of TSO commands like tools in a toolbox:

  • ALLOCATE is like opening a drawer and putting a label on it. You're telling the computer "this drawer (DD name) now holds this file (dataset)".
  • FREE is like taking the label off the drawer when you're done, so someone else can use that drawer name.
  • LISTCAT is like looking at a list of all your drawers and what's in them, so you can find what you're looking for.
  • DELETE is like throwing something in the trash—it's gone forever, so be careful!
  • SUBMIT is like giving your homework to the teacher. You hand it in, and the teacher grades it later while you do other things.
  • LOGOFF is like cleaning up your desk, putting everything away, and going home when you're done working.
  • HELP is like asking a teacher how to do something. You ask "how do I use this tool?" and the teacher shows you.

So TSO commands are like special tools that help you work with the computer, and each tool does a specific job!

Practice Exercises

Complete these exercises to reinforce your understanding of essential TSO commands:

Exercise 1: Command Practice

Practice using each essential command: ALLOCATE a dataset, use LISTCAT to verify it, FREE the allocation, use HELP to learn about each command, and practice SUBMIT with a test job. Document your experiences and any issues you encounter.

Exercise 2: Command Reference

Create a personal reference document for each essential command. Include syntax, common options, examples, and when to use each command. This reference will help you remember commands and use them effectively.

Exercise 3: Workflow Practice

Practice common workflows using these commands: allocate a dataset, work with it, free it, list your datasets, and submit a job. Create a workflow that uses multiple commands together and practice it until it becomes natural.

Exercise 4: Safety Practice

Practice safe command usage: verify dataset names before operations, test commands on non-critical data first, use HELP to check syntax, and always use LOGOFF properly. Develop habits that prevent mistakes and data loss.

Exercise 5: Command Comparison

Compare TSO commands with their ISPF equivalents. For example, compare TSO ALLOCATE with ISPF dataset allocation, or TSO LISTCAT with ISPF dataset list utilities. Understand when to use TSO commands versus ISPF menus.

Test Your Knowledge

1. Which TSO command allocates a dataset to a DD name?

  • ALLOCATE
  • ASSIGN
  • ATTACH
  • ALLOC

2. What command releases an allocation?

  • RELEASE
  • FREE
  • DEALLOCATE
  • UNALLOC

3. Which command lists catalog entries?

  • LIST
  • LISTCAT
  • CATALOG
  • SHOWCAT

4. What command ends your TSO session?

  • EXIT
  • QUIT
  • LOGOFF
  • END

5. Which command submits a batch job?

  • RUN
  • EXECUTE
  • SUBMIT
  • QUEUE

Related Concepts