[USflag] The American Programmer [USflag]


Home
Books on Mainframe Programming
Mainframe Manuals and Tutorials
System Abend codes, Sqlcodes, VSAM/QSAM codes
Everything about the IBM AS/400 Midrange Computer - iSeries
Everything about CICS
Everything about COBOL
Everything about DB2 and SQL
Everything about IMS
Everything about Java and JavaScript
Everything about JCL and JES
Everything about REXX
Everything about zOS, VSAM, Tivoli, Assembler
Everything about TSO, ISPF, Spufi
  TSO/ISPF: Just enough to get you started
  Running ISPF in batch. Tutorial.
  ISPF variables. Tutorial.
  TSO Line Mode Commands (such as DELETE, HRECALL, ALLOCATE, Line Mode EDIT)
  Executing SQL in Spufi. Tutorial.
  Comparison of REXX and CLIST
  Writing ISPF Editor macros
  Manuals for TSO
  Books on TSO, ISPF and CLIST
Site Map and Site Search

           Home   > TSO, ISPF, SPUFI   > TSO Commands

TSO Commands, TSO Line Mode Commands - TSO Native Mode Commands Tutorial

TSO - Time Sharing Option of IBM's mainframe operating system MVS (also called OS/390 or z/OS).
TSO is an on-line interactive program development system that gives access to the same files as with batch (JCL) jobs.
TSO is used to:
  • create, maintain and compile programs
  • create, maintain and submit JCL to run jobs
  • inspect the printed or displayed output of JCL jobs
  • interactively test both batch and on-line programs

Practically every installation uses ISPF or PDF to assist in program development.
ISPF/PDF is a full-screen, menu driven system similar in concept to Windows 3.
ISPF executes inside of TSO exactly as Windows 3 executed inside of DOS.
DOS was always there and you could always do DOS commands before and after going into Windows 3.
Similarly, you can execute TSO commands before and after you go into ISPF.
TSO Line Mode Commands are sometimes called Native TSO Commands, or just plain TSO commands. They are the things you can't always do with ISPF or PDF.
Running TSO commands while in ISPF is done in ISPF option 6, Command Shell, (like opening a DOS window in Windows 95 and later) or by prefixing the command with TSO and typing it on the command line of any ISPF screen.
With TSO commands, you can delete files, create or allocate files, rename files.
You can control migration and recall of files, although you often see ISPF screens which do that.
You can SEND messages to other TSO users. You can connect files to file handles (DDNAMES) in order to read or write to the files in a program, REXX exec or CLIST.
You need to know TSO line mode commands if you are going to master REXX or CLIST, since both REXX and CLIST can execute these TSO line mode commands.
You may print out this TSO command quick reference and use it at work.
The TSO COPY command is not included because it suffers from several design and implementation errors.

TSO Commands

Compliments of Gabe Gargiulo, author of several recent books on programming and modern languages, available at Amazon.com.

These are TSO line mode commands. There is generally no ISPF screen that will do the same thing. For help on the commands,

- on any ISPF screen, type TSO HELP; (If you are outside of ISPF just type HELP)

choose a command, then type TSO HELP command-name.

or use Quick Reference, in you have the product installed, by typing QW on any ISPF screen

then specify IBM as vendor

then search for TSO SYSHELP

There are 6 places you can execute TSO commands. Read the parts about continuing!

1. In a REXX program.

The command must be enclosed in quotes (") or apostrophes (').

Quotes are preferred, because they conflict less

with the apostrophes that some TSO commands require.

Example of an ALLOCATE command in a REXX program:

"ALLOC DDN(INFILE) SHR REUSE DSN(MY.DATA)"

When there is a variable in the command you want REXX to process the variable.

Quotes prevent REXX from processing the variable.

Remove the variable from the quotes.

Example of an ALLOCATE with the dataset name in a variable.

Dataset_Name = "MY.DATA"

"ALLOC DDN(INFILE) SHR REUSE DSN("Dataset_Name")"

In a REXX program commands for ISPF are prefixed by ADDRESS ISPEXEC, for example:

ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"

Commands for ISPF editor are prefixed by ADDRESS ISREDIT, for example:

ADDRESS ISREDIT "CHANGE ALL DNS DSN"

 

Continuing. Break the command into two parts.

Enclose each part in quotes. End the first part with a comma.

EXAMPLE:

"ALLOC DDN(INFILE)SHR REUSE",

"DSN(MY.DATA)"

2. In a CLIST.

The command is entered into the CLIST as shown in the examples.

Example of an ALLOCATE command in a CLIST:

ALLOC DDN(INFILE) SHR REUSE DSN(MY.DATA)

When there is a variable in the command, put the variable

in the command and be sure it is prefixed with an ampersand (&).

Example of ALLOCATE in a CLIST with the dataset name in a variable:

SET &DATASET_NAME = MY.DATA

ALLOC DDN(INFILE) SHR REUSE DSN(&DATASET_NAME)

 

Continuing. Break the command into two parts. End the first part with a hyphen or +. The + causes leading spaces on the next line to be deleted..

EXAMPLE:

ALLOC DDN(INFILE) SHR REUSE -

DSN(&DATASET_NAME)

 

3. In ISPF Option 6.

Enter the command as shown in the examples

Example of an ALLOC command in ISPF Option 6:

ALLOC DSN(MY.DATA) SHR REUSE DDN(INFILE)

 

Continuing. Just keep typing. There’s room..

 

4. On any ISPF screen except Option 6.

Enter the command as shown in the examples, prefixed with "TSO".

Example of an ALLOCATE command in ISPF Option 6:

TSO ALLOC DDN(INFILE) SHR REUSE DSN(MY.DATA)

 

Continuing. You are out of luck. There’s not much room.

 

5. In line mode TSO, known as "Ready mode". I.E., you are not in ISPF.

Enter the command as shown in the examples

Example of an ALLOCATE command in line mode TSO.

ALLOC DDN(INFILE) SHR REUSE DSN(MY.DATA)

 

Continuing. Just keep typing. There’s room..

 

6. In a batch job where the program IKJEFT01 is executed, known as TSO in batch.

Enter the command as shown in the examples

Example of an ALLOCATE command in a batch job.

ALLOC DDN(INFILE) SHR REUSE DSN(MY.DATA)

Example in context:

//STEP1 EXEC PGM=IKJEFT01,DYNAMNBR=200

//SYSPRINT DD SYSOUT=*

//SYSTSPRT DD SYSOUT=*

//SYSTSIN DD *

ALLOC DDN(INFILE) SHR REUSE DSN(MY.DATA)

/*

Continuing. There are only about 67 positions available

Break the command into two parts. End the first part with a hyphen.

EXAMPLE:

ALLOC DDN(INFILE) SHR REUSE -

DSN(MY.DATA)

 

 

Interacting with files:

Create a catalogued disk file/dataset

ALLOCATE with the NEW keyword

ALLOC DSN(dataset-name) NEW (see above for how to continue)

SPACE(10 5) TRACKS

Create a catalogued disk library/pds

ALLOCATE with the NEW keyword and the DIR keyword

ALLOC DSN(library name) NEW (see above for how to continue)

SPACE(10 5) TRACKS DIR(10)

Connect a catalogued disk file/ dataset to a program for use as input or output

ALLOCATE with the SHR or OLD keyword and the DDN keyword

ALLOC DDN(ddname) SHR REUSE DSN(dataset-name)

Connect a catalogued library member/pds member to a program for use as input or output

ALLOCATE with the SHR or OLD keyword and the DDN keyword

ALLOC DDN(ddname) SHR REUSE (see above for how to continue)

DSN(library-name(member-name))

Note that the library must exist.

The member must exist if it is input.

The member will be created or overwritten, if it is output.

Connect a catalogued disk file/ dataset to a program for use as output, lengthening (append) the file

ALLOCATE with the MOD keyword and the DDN keyword

ALLOC DDN(ddname) MOD REUSE DSN(dataset-name)

Create a catalogued disk file/dataset, or library/ pds that has the same attributes as another

ALLOCATE with the LIKE keyword

ALLOC DSN(dataset-name) LIKE(other-dataset-name)

Notes about ALLOCATE:

REUSE means that the DDN(ddname) should be released

from any previous use and used for this ALLOCATE

SPACE(10 5) means that the system should allocate

10 units of space immediately, 5 units later (up to 15 times as needed)

DIR(10) means that the system should reserve 10 blocks of

space for the directory that will keep track of the members.

1 directory block keeps track of 5 members.

Remove the connection between a file and a program that has been established with ALLOCATE and the DDN keyword

FREE DDN(ddname)

Copy a file to one that exists already, overlaying it. (Allocate the output file first with ALLOC or ISPF 3.2)

REPRO INDATASET(‘input dataset name’) (see above for how to continue)

OUTDATASET(‘output dataset name’)

Display the attributes of a file/dataset library/pds

LISTDS dataset-name or library

Display the attributes of a library/pds and list the member names

LISTDS library MEMBERS

Display the dataset names, library names, and DDNAMES currently in use in your TSO session.

LISTALC STATUS HISTORY SYSNAMES

Display catalog information about a specific dataset or library.

LISTCAT ENTRY(dataset name) ALL

List the names of datasets or libraries whose names begin with a specific high level qualifier.

LISTCAT LEVEL(high-level-qualifier)

Example:

LISTCAT LEVEL(USERID1)

Delete a dataset or library

DELETE dataset or library

Delete a library member (not the library)

DELETE library(member-name)

Rename a dataset or library

RENAME old-name new-name

Specify a REXX or CLIST library without having to do complicated allocations.

ALTLIB ACTIVATE APPLICATION(appl) DSN(appl-library)

Specify a REXX library

ALTLIB ACTIVATE APPLICATION(EXEC) DSN(rexx-library)

Specify a CLIST library

ALTLIB ACTIVATE APPLICATION(CLIST) DSN(clist-library)

Interacting with other users

Authorize access to your files with RACF.

PERMIT 'your-userid.**' ID(userid-to-authorize) ACCESS(READ)

or access(update)

userid-to-authorize may be * to mean all users

Transmit a message to a TSO user. Cancel the message if the user can’t receive messages or is logged off.

SEND 'the message' USER(the-userid)the-userid may be *, which means to yourself

Transmit a message to a TSO user. Wait until the user is able to receive the message.

SEND 'the message' USER(the-userid) WAIT

the-userid may be *, which means to yourself

Transmit a message to a TSO user. The message will be delivered at once if the user is logged on. It will be delivered when the user logs on, if the user is now logged off.

SEND 'the message' USER(the-userid) LOGON

the-userid may be *, which means to yourself

Transmit a message to the console operator

SEND 'the message'

Send a dataset to another user (TSO or CMS)

XMIT node.userid DSN(datasetname)

Send a library/pds member to another user (TSO or CMS)

XMIT node.userid DSN(libraryname(membername)) SEQ

Receive a dataset or library sent by another user with XMIT

RECEIVE

 

Interacting with TSO

Display messages sent to you while you were logged off

LISTBC

Display the current time, CPU time used, service units used, and date

TIME

Turn off prompting - commands asking you for missing or invalid information

PROFILE NOPROMPT

Find out if TSO is prefixing your logon userid to dataset names specified without apostrophes.

PROFILE

Make TSO prefix your logon userid to dataset names specified without apostrophes.

PROFILE PREFIX(your-userid) The default

Stop TSO from prefixing your logon userid to dataset names specified without apostrophes.

PROFILE NOPREFIX Not Recommended

Execute a program when you know which library it is on

CALL ‘library-name(program-name)’

Execute a program that is on an automatic search library ("the linklist")

CALL *(program-name)

You may also be able to execute a program by simply putting its name in quotes:

"IEBGENER"

This is not allowed at all companies.

Execute a REXX program or CLIST found on a library assigned to SYSPROC or SYSEXEC

"program-name" "parameters if any"

Execute a REXX program or CLIST that is not found on a library assigned to SYSEXEC

"EXEC ‘libry-name(member-name)’ ‘parameters if any.’ " EXEC

Execute a CLIST that is not found on a library assigned to SYSPROC

"EXEC ‘library-name(member-name)’ ‘parameters if any.’ "

Interacting with MVS Batch

Display current job status of jobs that you have submitted

STATUS

Cancel a job that you have submitted

CANCEL jobname(job-number)

Cancel a job that you have submitted and discard the printed output

CANCEL jobname(job-number) PURGE

Send JCL to MVS batch for processing I.E. spawn a detached process

SUBMIT dataset-name or library(member-name)

Interacting with the Hierachical Storage System (migrating)

Unmigrate a dataset or library that has been migrated

HRECALL dataset/library

Migrate a dataset or library I.E. send it to off-line storage, probably tape

and temporarily delete it from active disk storage

HMIGRATE dataset or library

Create a backup copy of a dataset or library (if installation authorizes)

HBACKDS dataset/library

Retrieve the most recent backup copy of a dataset or library that has been backed up

HRECOVER dataset-name

Retrieve the backup copy of a dataset or library that was created before the most recent one

HRECOVER dataset-name GENERATION(1)

Ask about your HRECOVER request.

HQUERY

 

Using ISPF services.

Specify a library that contains components of an ISPF dialog.

LIBDEF component DATASET ID(library-name) UNCOND

for example:

LIBDEF ISPPLIB DATASET ID(MY.ISPPLIB) UNCOND

REXX Example:

ADDRESS ISPEXEC "LIBDEF ISPPLIB DATASET ID(MY.ISPPLIB) UNCOND "

Components are:

ISPPLIB Panel library

ISPSLIB File Tailoring Skeleton Library

ISPMLIB Message library

ISPFILE File Tailoring output library

ISPTLIB Table input

ISPTABL Table output

ISPLLIB Load module

Store variable information in TSO/ISPF for later use

VPUT (variable-name) PROFILE

REXX Example:

ADDRESS ISPEXEC "VPUT (variable-name) PROFILE"

Retrieve variable information from TSO/ISPF

VGET (variable-name)

REXX Example:

ADDRESS ISPEXEC "VGET (variable-name)"

Setting messages that will appear on ISPF screens.

REXX Example:

ZEDSMSG = "this is the short message"

ZEDLMSG = "this is the long message"

ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"

Executing a program when you don't know which library it is on

SELECT PGM(program-name)

REXX Example:

ADDRESS ISPEXEC "SELECT PGM(program-name)"

Prevent an ISPF error from kicking you out of your session. (Hides diagnostic messages)

CONTROL ERRORS RETURN

REXX Example:

ADDRESS ISPEXEC "CONTROL ERRORS RETURN"

 

 

Old non-ISPF editor.

I will show this by an example. The line numbers on the left are for illustration only.

1 EDIT 'userid.TEST.CNTL(MODEL)' DATA OLD NONUM EMODE

2 TOP

3 CHANGE * 999 '@DSN' 'MY.DATA'

4 SUBMIT

5 END NOSAVE

Explanations by line.

Line 1. EDIT 'fully-qualified-dataset-name' DATA OLD NONUM EMODE

Please use a fully-qualified dataset name, with apostrophes.

Replace DATA with COBOL if it is a COBOL program.

OLD means that it exists already

NONUM means that the editor should ignore line numbers, if any.

NUM instead means that the editor should assume line numbers

EMODE means that the editor should not go into "input mode"

when the dataset contains no records

Input Mode is when the editor accepts no commands!

everything you type in is placed into the dataset as a new line.

You end Input Mode by pressing ENTER without typing anything.

Line 2.

TOP.

Position yourself at the top of data (important for the change command)

Line 3.

Change character strings on each line from current line position

(shown by *) to the end (shown by 999)

CHANGE * 999 'old string' 'new string'

Line 4.

Send the data you are editing (if it's JCL) to MVS batch for processing

I.E. spawn a detached process

SUBMIT

Line 5.

Exit without saving data in the name you started with

END NOSAVE

Other commands you might use.

Exit and save data in the name you started with

END SAVE

Save what you are editing with a specific name other than the one you started with

SAVE new-name REUSE

Placing the above example (code after "Old non-ISPF editor." above.) in a REXX program. You must queue the commands. They will be executed after the REXX program ends. (There is no way to change this action.) You may not put anything else into the queue since that will interfere with this.

QUEUE "EDIT 'userid.TEST.CNTL(MODEL)' DATA OLD NONUM EMODE"

QUEUE "TOP"

QUEUE "CHANGE * 999 '@DSN' 'MY.DATA' ALL"

QUEUE "SUBMIT

QUEUE "END NOSAVE"

Placing the above example in a CLIST. (See the code right under "Old non-ISPF editor" above.( The CLIST will execute the commands line by line. After finishing the commands, control will remain in the CLIST.

 

Visit my web page to get other cheat sheets.

http://theamericanprogrammer.com/programming/justenuf.shtml

Rexx info: http://theamericanprogrammer.com/rexx/index.shtml

 

Compliments of Gabe Gargiulo, author of several recent books on programming and modern languages, available at Amazon.com.

Top of Page














































































































[Books Computer]

Home Books for Computer Professionals Privacy Terms |
Site Map and Site Search Programming Manuals and Tutorials The REXX Files Top of Page |