|

What is a TSO Command Processor?
by Steve Myers
A TSO command processor is a program that meets the following criteria.
- It is invoked from the TSO READY prompt by the TSO Terminal Monitor
Program, or from some similar capability, such as ISPF Option
6.
- It uses the IKJPARS service routine to analyze the command line.
- It uses the TSO messaging routines, such as IKJEFF02, IKJPUTL and
IKJEFF18 to format and write messages to the user terminal.
- Most Command Processor programs use dynamic allocation to
gain access to data.
The remainder of this series of articles will talk
about the techniques used to write a TSO Command Processor.
By Assembler
programming
standards, writing a command processor is not
hard.
In
fact, up to a point, it is pretty cut and dried. In
pseudo-code, all
Command
Processors follow the outline shown in Figure 1.
Figure 1
Prepare control blocks to call the TSO Service Routines
If IKJPARS return code = 0
Analyze output from IKJPARS
Allocate datasets
Do your thing, using the message routines to send output to the terminal
|
The big difference between TSO and batch is any output
intended for the terminal is sent there using the TSO
service routines.
The reason for this is so that CLIST and Rexx programs
can "trap" this
output. Output sent to the terminal using the TPUT
service macro, or by allocating a data set to the terminal
and using
DCB based
services cannot be trapped. Everything else is the
same. A DCB is a DCB. A data set is a data set. TSO
is EBCDIC,
not this ASCII
upstart. Dynamic allocation works exactly the same
way in TSO as it does in batch.
TSO was first released in 1971. It has stood up quite
well. From the point of view of people writing Command
Processor
programs,
there are only minor, though important, changes.
- IKJPOSIT supports the USID parameter, so that IKJPARS will automagically
insert the userid specified by the PROFILE PREFIX
option into presumptive data set names
- The IKJEFF02 service routine is documented for end users
- The IKJEFF18 service routine is documented for end users
- The CALLTSSR macro can be used to invoke some TSO service routines.
TSO Control Blocks Used by Command Processors
Figure 2 describes two of the control blocks that are important
for TSO Command Processor programs.
| Figure 2 |
|
|
| Control Block |
Macro |
Purpose |
| CPPL - Command Processor Parameter List |
IKJCPPL |
- The CPPL is passed to every command processor in register
1. It contains four words that contain pointers.
- CPPLCBUF -
The address of the Command Buffer. In other words, the
command that started the command processor
-
CPPLECT - The address of
a control block used mostly by other TSO service routines
- CPPLUPT
- The address of a control block used mostly by other
TSO service routines
- CPPLPSCB - The address of a control block used mostly
by other TSO service routines
|
| PPL - Parse Paameter List |
IKJPPL |
- The PPL is the parameter list sent to the IKJPARS service routine -
- PPLCBUF -
The address of the command buffer
- PPLUPT - The address of the UPT
- PPLECT
- The address of the ECT
- PPLECB - The address of an ECB.
The high order byte of the
ECB should be 0.PPLPCL - The address of a PCL. The PCL is created
by a series of macros called the Parse macros.
- PPLANS -
The address of a word in storage.
After IKJPARS completes this word points to the main output of
IKJPARS, the PDL. The DSECT that describes the PDL is created
by
the same Parse macros that
created the PCL.PPLUWA - The address of a data area created by
the
user and of importance only to the user. IKJPARS does
not inspect
or alter this work
area.
|
The next article will create an almost do nothing command processor.
Download and examine the source code to a sample TSO command
prompter. It is called SENDTOME and it will serve as an example
that you can use to follow along with in the upcoming articles.
|