Sei sulla pagina 1di 12

TSO Line Mode Commands

Get this document at http://www.theamericanprogrammer.com/programming/tsocmd.shtml

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;
choose a command, then type TSO HELP command-name.
or use Quick Reference 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. Information about my book on REXX:
http://www.theamericanprogrammer.com/programming/index.shtml
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")"

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)"

1 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


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)
From http://www.theamericanprogrammer.com commercial use or resale of this document is a violation of copyright laws.

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..

2 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


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)

This document is presented with my compliments.


You may use it for reference.
You may not use it for teaching a class without my permission
You may not claim that you wrote it.
You may not sell it in any way.

3 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


Interacting with files:

Create a catalogued disk file/dataset


ALLOCATE with the NEW keyword
ALLOC DSN(dataset-name) NEW (continued)
SPACE(10 5) TRACKS

Create a catalogued disk library/pds


ALLOCATE with the NEW keyword and the DIR keyword
ALLOC DSN(library name) NEW (continued)
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 (continued)
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)

4 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


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') (continued)
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)

5 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


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) -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
From http://www.theamericanprogrammer.com commercial use or resale of this document is a violation of copyright laws.

6 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


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.' "

7 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


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

8 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


Using ISPF services.
Information about my book on ISPF Dialogue manager http://www.theamericanprogrammer.com/programming/dmbook/html
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"

Created by http://www.theamericanprogrammer.com. You may copy this document provided this notice is attached.

9 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


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

10 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


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

The above example in a REXX program. You must queue the commands. They will be executed
after the REXX program ends. 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"

The above example in a CLIST. There is no change from the example 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://www.theamericanprogrammer.com/programming/index.shtml
Rexx info: http://www.theamericanprogrammer.com/programming/index.shtml

11 Mainframe programming: http://www.Theamericanprogrammer.com/programming/


About this series.
Sometimes you need just enough information so that you can do something - it gets you started
when you don’t have time to learn everything. Get them at
http://www.theamericanprogrammer.com/programming/justenuf.shtml

Other Books for professionals:

REXX Reference
All REXX verbs, keywords, and built-in functions as found in MVS, VM/CMS and OS/2.
About 100 pages. Ready to ship.
Order from MVS Training (800) 356 9093. http://www.mvs-training.com

The REXX Language on TSO


How to use the REXX programming language on TSO. Information, ordering at:
http://www.theamericanprogrammer.com/programming/rexx.programming.book.
shtml

ISPF Services: Using the Dialogue Manager with REXX


How to create ISPF panels on TSO. Examples are in REXX. Information, ordering at:
http://www.theamericanprogrammer.com/programming/dialogue.manager.ispf.
book.shtml
Created by http://www.theamericanprogrammer.com. You may copy this document provided this notice is attached.

You will find a large selection of mainframe books at:


http://www.theamericanprogrammer.com/books/index.shtml

You’ll find manuals on TSO, JCL, REXX, COBOL, DB2 at:


http://www.theamericanprogrammer.com/programming/manuals.shtml
This document is presented with my compliments.
You may use it for reference.
You may not use it for teaching a class without my permission
You may not claim that you wrote it.
You may not sell it in any way.

12 Mainframe programming: http://www.Theamericanprogrammer.com/programming/

Potrebbero piacerti anche