Understanding TSO command syntax is essential for effectively using TSO commands. TSO commands follow specific rules for format, structure, and syntax. Learning these rules enables you to construct commands correctly, understand command documentation, and use TSO commands effectively. This tutorial covers the general format of TSO commands, qualifiers, continuations, and other syntax elements.
TSO command syntax may seem complex at first, but it follows consistent patterns. Once you understand the basic structure and rules, you can construct and understand commands more easily. This knowledge is fundamental for using TSO commands, whether you're entering commands directly at the TSO READY prompt or including them in scripts and CLISTs.
TSO commands follow a general format that consists of a command name followed by operands. Understanding this basic structure is the foundation for using TSO commands effectively.
The general format of a TSO command is:
1COMMAND operands
Where:
For example, a simple TSO command might be:
1LISTCAT
This command has no operands—it just lists catalog entries using default options. A more complex command might be:
1ALLOCATE FILE(DDNAME) DATASET('USERID.SOURCE.COBOL')
This command includes operands (FILE and DATASET qualifiers) that specify what to allocate and how.
TSO command names follow specific rules:
Using abbreviations can speed up command entry, but using full command names makes commands more readable, especially in scripts or documentation.
TSO commands are entered at the TSO READY prompt:
For example, at the READY prompt, you might type:
12READY LISTCAT
Then press Enter to execute the LISTCAT command.
Operands are the parameters, qualifiers, and options that follow the command name. They provide additional information that tells TSO what to do, how to do it, or what to operate on.
Operands can take different forms:
For example, in the command:
1ALLOCATE FILE(DDNAME) DATASET('USERID.SOURCE.COBOL') SHR
FILE and DATASET are keyword operands (with values in parentheses), and SHR is a flag that specifies shared access.
Operands follow specific syntax rules:
Understanding these rules helps you construct commands correctly and interpret command documentation.
Qualifiers are keyword operands that modify command behavior or provide specific information. They use the format KEYWORD(value) and allow you to specify detailed parameters for commands.
Qualifiers use the format:
1KEYWORD(value)
Where KEYWORD is the qualifier name and value is the value for that qualifier. For example:
1FILE(DDNAME)
Here, FILE is the qualifier keyword and DDNAME is the value specifying the file (DD name) to allocate.
Commands can have multiple qualifiers, separated by spaces:
1ALLOCATE FILE(DDNAME) DATASET('USERID.SOURCE.COBOL') SHR REUSE
This command has multiple qualifiers: FILE specifies the DD name, DATASET specifies the dataset name, SHR specifies shared access, and REUSE allows reusing an existing allocation.
For most commands, qualifier order doesn't matter when using keyword qualifiers. These two commands are equivalent:
1ALLOCATE FILE(DDNAME) DATASET('DSNAME')
1ALLOCATE DATASET('DSNAME') FILE(DDNAME)
However, some commands may have restrictions on qualifier order, and positional operands (if any) must come before keyword qualifiers. Always refer to command documentation for specific requirements.
Many TSO commands use common qualifiers:
These qualifiers appear frequently across different TSO commands, so learning them helps you understand many commands.
TSO commands can be continued across multiple lines for readability. This is especially useful for long commands with many qualifiers or complex parameters.
To continue a command on the next line, end the current line with a continuation character:
The continuation character tells TSO that the command continues on the next line, so it doesn't try to execute the command when you press Enter after the continuation character.
Here's an example of a continued command:
123ALLOCATE FILE(DDNAME) - DATASET('USERID.SOURCE.COBOL') - SHR REUSE
This command is spread across three lines. The hyphens at the end of the first two lines indicate continuation. When you press Enter after the last line (without a continuation character), TSO executes the complete command.
When using continuations:
Continuations make long commands more readable and easier to edit, especially in scripts or when entering complex commands.
Here are examples of continued commands:
123ALLOCATE FILE(INFILE) - DATASET('USERID.INPUT.DATA') - SHR
This allocates a file with multiple qualifiers, continued across lines for readability.
123SUBMIT 'USERID.JCL.JOB(MEMBER1)' - CLASS(A) - NOTIFY(USERID)
This submits a job with multiple parameters, using continuations to organize the command.
Understanding how to use quotes and handle special characters is important for constructing TSO commands correctly.
Quotes are used to enclose values that contain spaces or special characters:
For example:
1LISTCAT ENT('USERID.SOURCE.COBOL')
The dataset name is quoted to ensure it's treated as a single value.
TSO typically accepts both single quotes (') and double quotes ("), though single quotes are more commonly used:
1DATASET('USERID.SOURCE.COBOL')
1DATASET("USERID.SOURCE.COBOL")
Both forms are usually equivalent. Use the type that's consistent with your organization's conventions or that matches the examples in your command documentation.
Some characters have special meaning in TSO commands:
If you need to use these characters as literal characters (not with their special meaning), you may need to quote them or use escape sequences, depending on the command and context.
Many TSO commands can be abbreviated to save typing. Understanding abbreviations helps you work more efficiently.
Command abbreviations follow rules:
For example, "LISTCAT" can often be abbreviated as "LISTC" or "LC", and "ALLOCATE" can be abbreviated as "ALLOC" or "AL".
Here are some common TSO command abbreviations:
These abbreviations can speed up command entry, especially when typing commands frequently.
Consider using abbreviations when:
Consider using full command names when:
TSO provides help for command syntax, which is invaluable when learning commands or checking syntax details.
To get help for a TSO command, use the HELP command:
1HELP commandname
For example:
1HELP ALLOCATE
This displays help information for the ALLOCATE command, including syntax, qualifiers, examples, and descriptions.
HELP typically provides:
Using HELP is an excellent way to learn command syntax and discover available options.
Many TSO commands follow common syntax patterns. Recognizing these patterns helps you understand and use commands more effectively.
Commands that allocate resources often follow this pattern:
1ALLOCATE FILE(DDNAME) DATASET('DSNAME') [options]
Where options might include SHR (shared), OLD (exclusive), REUSE, etc.
Commands that list information often follow this pattern:
1LIST[CAT|DS|ALC] [ENT('name')] [options]
Where you specify what to list and optional filtering or display options.
Commands that perform operations often follow this pattern:
1OPERATION target [qualifiers] [options]
Where you specify the operation, what to operate on, and how to perform the operation.
Recognizing these patterns helps you understand new commands and construct commands correctly.
Following best practices helps you use TSO commands effectively and avoid errors:
Imagine TSO commands are like sentences you tell the computer:
So TSO command syntax is like learning how to talk to the computer in its special language, using the right words in the right order!
Complete these exercises to reinforce your understanding of TSO command syntax:
Take several TSO commands (from documentation or examples) and identify the command name, operands, qualifiers, and any flags or options. Document the structure of each command and explain what each part does. This helps you recognize patterns in command syntax.
Write a long TSO command (like a complex ALLOCATE command with many qualifiers) and practice writing it with continuations. Try different ways of breaking it across lines and see which is most readable. Practice entering continued commands to become comfortable with the syntax.
Practice writing TSO commands with and without quotes for dataset names. Identify when quotes are necessary and when they're optional. Test commands to see how quotes affect command execution and learn the rules for your environment.
Use the HELP command to find common TSO commands and discover their abbreviations. Create a reference list of commands and their abbreviations. Practice using abbreviations and verify they work correctly in your environment.
Choose a TSO command you use frequently and document its complete syntax, including all qualifiers, options, and examples. Use the HELP command to gather information, then create your own reference document. This helps you understand the command deeply and creates a useful reference.
1. What character is typically used to continue a TSO command on the next line?
2. What is the general format of a TSO command?
3. Are TSO commands case-sensitive?
4. What prompt indicates you can enter TSO commands?
5. How do you get help for a TSO command?