Mainframes 360
The one stop destination for System Z professionals

Saturday, November 17, 2012

TSO and ISPF


  This post is partially complete and several sections may require editing and proof-reading. The contents on time sharing, TSO and ISPF is under updation.

Early Batch-oriented Operating Systems
In the early 1950s, many organizations bought electronic computers such as the IBM 701(known as the Defense Calculator) and IBM 704. There were only 19 IBM 701s manufactured in the world. A computer system was delivered as hardware and a set of manuals. These computers were single-user, non-shareable, one job at a time systems. The IBM 701 rented at an astonishing $23,750 a month. This is a picture of an IBM 701 computer room(Source : Columbia.edu).



How were these computers operated? Computer sessions were scheduled as a blocks of time, by programmers. The programmer entered the computer room and signed a First-In-First-Out list, much like you do at a crowded restaurant. The programmer then frequently checked the progress and estimate when he would reach the top. When his time was close, he would be ready with a deck of cards in his hand. When the previous person finished, the next programmer rushed in, checked the printer board , the punch board, the reader board, hung a magnetic tape, punched his time in a mechanical clock, set the console switches, loaded the card deck, prayed that the first card wouldn't jam, and pressed the load button. The typical 701 setup took about five minutes.



There was always unused time between computer sessions. There used to be backlogs of work that was to be programmed and tested, as well as a back-log of production trails. There was a shortage of computer time.

To push more jobs per shift through the installed computers, IBM customers like General Motors developed an operating system GMR NAA I/O(General Motors and North American Aviation) I/O System. It first ran in production in 1956. The Operating sytem completed a job in 3 distinct phases - an Input translation phase, the execution phase and an output translation phase. After one job was complete, the next job in quueue would automatically start. Programmers were thrown out of the computer rooms and professional operators were hired. This was the world's first operating system on a mainframe.

A Batch processing Operating System consisted of a component called the Batch Monitor or Supervisor, that was a permanent part of the computer memory. The memory map below shows the arrangement of the Operating system and the user job in computer memory.



Multi-programmed Operating Systems
A program is a sequence of instructions. There are declarations, assignments, arithmetic operations like ADD and SUBTRACT, I-O operations like READ and WRITE. Generally, performing Input/Output e.g. reading a card from a deck takes longer than other operations like adding two numbers up. The CPU spent a lot of time doing I/O. Programs took longer to complete. The new mainframe computer System/360(S/360) had an improved machine architecture. It allowed the CPU to free itself from the I-O operation. The CPU was capable of performing other instructions of a program p2, while the I-O operation of program p1 was in progress.



I-O Channels and Interrupt hardware
The new mainframe computer Systems/360 had an I-O subsytem. The I-O subsystem has one or more channels. A channel is a special I/O processor and has an independent data and address path between the I-O device and computer memory. When a program executes an I-O instruction, say a READ instruction on a device, the CPU transfers the details of the READ operation to the I-O subsystem. The CPU is not involved in the I-O operation beyond this point. The I-O subsystem and the CPU can function independently. The CPU, however, has no way of knowing when the I-O subsystem has completed its work, unless the I-O subsystem tells it. Thus, I-O subsystem sends a flash, a signal to the CPU. This is called an I-O Interrupt. The System/360 is fitted with special interrupt hardware. Interrupt hardware causes the CPU to execute the Supervisor, which realizes that the I/O operation is complete and processes the interrupt.


Channel Program and Channel Command Words(CCW)
A Channel Program contains instructions for the I-O channel to perform an I-O operation. The channel program is a list of instructions called Channel Command Words(CCW). The Channel Program is stored in Main Memory. The channel program is passed to the I-O Channel, at I/O time.

In order to write your own channel program, you should have profound knowledge of the characteristics of the I-O device. For example, to write a channel program for a disk-drive, you must know its physical structure, data-formats, access mechanisms etc. The channel programs for a disk-drive and a tape would be different. The reference manual for any I-O device(like a disk-drive or tape), details all the Channel Command Words(CCWs) you can use with the device. For example, with 3380 disk drives, the SEEK command is used to access a particular (Cylinder,Track) position. The SEEK head command is used to control a Read/Write Head within the current cylinder.

Programmers needed a device-independent way of doing Input-Output. Access-methods offer a device-independent way to do Input-Output. With access-methods, you don't need to write your own channel programs. When a user-program executes I-O operations like OPEN, READ, WRITE and CLOSE the access-method software builds a channel program in memory. After the list of Channel Command Words(CCWs) are ready, the access method directs the Operating System(OS) supervisor to execute the channel program by means of EXCP(Execute Channel Program) instruction.



The OS supervisor starts the Input-Output by issuing STARTIO <device-address> command. This causes the I-O Channel to fetch an address from the Channel Address Word(CAW). The Channel Address Word(CAW) contains the address of the first CCW in main storage. This is loaded into Instruction Counter(IC) of the I-O Channel. The STARTIO instruction is complete and the CPU is free to perform other tasks.


OS/360 and its variants
IBM launched its new mainframe computer System/360 in 1964. There are three variants of OS/360 operating system.

(i) PCP(Primary Control Program) in April, 1964 – This was meant for small users with less memory. It could run one job at a time.
(ii) MFT(Multi-programming with Fixed number of tasks) in April, 1966 – This was targeted towards mid-range users. Each job was processed in the fixed area of the main storage known as a partition. The number of partitions were decided at install-time. When a job waited for the completion of an event such as I/O, another job of lower priority was allowed to proceed.
(iii) MVT(Multi-programming with Variable number of tasks) in August 1967 – MVT was for the top-end. It could run a variable number of tasks.

The origins of Time-Sharing 
Time-Sharing reduces the delays in receiving results. A large number of jobs share the system resources concurrently. Actually, only one job is active at any moment in time. One job is assigned the main storage region and short period of processing time called a time-slice. The other jobs are saved on secondary storage, while the job in the main storage is being run.

Once the time-slice is over or the job enters the WAIT state for terminal I/O, the main storage image of the job is copied to auxiliary storage. The Operating System dispatcher brings another job into the same region of main storage and is given a time-slice.

The credit for the genesis of time-sharing goes to Bob Bemer. He wrote of, how computers of the future were going to be costly and more powerful, and hence they must be shared by many users, in his article How to Consider A Computer, published under the Data Control section of the Automatic Control Magazine, in March, 1957.

The Compatible Time Sharing System(CTSS) was the first Time Sharing operating system, built at MIT in 1961.

IBM had developed CP/40 and CP/67 time-sharing systems as a research initiative. Instead, IBM introduced TSO(Time Sharing Option) as an optional feature in OS/360 MVT, which is now a standard component of the zO/S.

TSO(Time Sharing Option)
The TSO/E software presents a command-line interface to the zOS. When you log on to TSO, a READY prompt is displayed on the terminal.

 READY                                                                          





You may enter commands like ALLOC, EDIT, DELETE, RENAME, SUBMIT, CANCEL to perform day-to-day tasks such as creating, editing and deleting files, submitting jobs to the system etc.The TSO software processes the commands, you type at the READY prompt. TSO is a command processor. For example, I have typed LISTCAT command to list the attributes of the file SYSADM.DEMO.SRCLIB(We’ll discuss about files at length, later).

 
READY
LISTCAT ENTRIES('SYSADM.DEMO.SRCLIB') ALL
NONVSAM ------- SYSADM.DEMO.SRCLIB
IN-CAT --- CATALOG.OS390.MASTER
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2011.143
RELEASE----------------2 EXPIRATION------0000.000
VOLUMES
VOLSER------------OS39M1 DEVTYPE------X'3010200F' FSEQN---------
---------0
ASSOCIATIONS--------(NULL)
ATTRIBUTES
READY



But, how does TSO accomplish time-sharing? Here is an analogy. When still images are flashed before your eyes in rapid succession at about 24 frames per second, the naked eye perceives it as a motion picture.

A TSO session is really a job, which runs the TSO software program. As an example, if two users A and B are logged-on, there would be two TSO jobs running. Time is sliced between the two TSO jobs. Assume a time-slice is 2 seconds. Under the hood, the CPU runs the TSO job A for 2 secs., then switches to TSO Job B, it runs for 2 secs., and back to TSO job A for 2 seconds and so forth. In reality, the CPU rapidly switches back and forth between the two TSO tasks, giving an illusion that both the tasks are running at the same time. 

On a real mainframe system, there are hundreds of jobs competing for the CPU, the TSO jobs of the active users, other batch job(s) and STARTed tasks.

ISPF(Interactive System Productivity Facility)
Personal computers having x86 architecture support operating systems like the MS Windows. The MS Windows OS has a command-line interface called the DOS-Prompt. On the DOS-prompt, you enter commands like MOVE, REN, COPY, COPYCON, EDIT etc. to do routine things such as creating a file/folder, editing a file, move or copy files. MS Windows also offers a Graphical User Interface(GUI) called the Desktop(Shell).

On clicking the Start button, different menus appear. A logically-related set of functions are grouped under one menu. For example, application programs are grouped under Programs menu. Utilities such as the Notepad, Paint, Calculator are below the Accessories> Menu. Network settings, Printer settings are found under the Settings Menu. To run an application like Microsoft Word, you navigate to Start >> Programs >> Microsoft Office >> Microsoft Word.

TSO Software on the mainframe system can be likened to the DOS-prompt. To do things like creating files, edit files, and running programs you would enter commands at the TSO prompt. As an example, I wanted to create a new file SYSADM.MY.TEST.FILE, so I keyed in the whole ALLOC command, with all its parameters in full glory.

 READY                                                                           
ALLOC DA('SYSADM.DEMO.TEST.FILE') DSORG(PS) SPACE(10,10) TRACKS LRECL(80)
BLKSIZE(800) RECFM(F,B) NEW

READY




ISPF is equivalent to a Graphical User Interface(GUI) on the Mainframe. ISPF has window-like panels. This is what an ISPF window looks like. It is used to search a file on the mainframe computer.

   Menu  RefList  RefMode  Utilities  Help                                      
------------------------------------------------------------------------------
Data Set List Utility
Option ===>


blank Display data set list P Print data set list
V Display VTOC information PV Print VTOC information

Enter one or both of the parameters below:
Dsname Level . . . SYSADM.DEMO.REXXLIB
Volume serial . .

Data set list options
Initial View . . . 1 1. Volume Enter "/" to select option
2. Space / Confirm Data Set Delete
3. Attrib / Confirm Member Delete
4. Total / Include Additional Qualifiers

When the data set list is displayed, enter either:
"/" on the data set list command field for the command prompt pop-up,
an ISPF line command, the name of a TSO command, CLIST, or REXX exec, or
"=" to execute the previous command.


ISPF has a menu-driven interface. A picture of the ISPF Home screen is shown below. As you can see, it has menus, like 1 - View, 2 - Edit, 3 - Utilities, 4 - Foreground, 5 - Batch and so forth. To select menu, just key in the appropriate option.

   Menu  Utilities  Compilers  Options  Status  Help                            
------------------------------------------------------------------------------
ISPF Primary Option Menu
Option ===>


0 Settings Terminal and user parameters User ID . : SYSADM
1 View Display source data or listings Time. . . : 14:42
2 Edit Create or change source data Terminal. : 3278
3 Utilities Perform utility functions Screen. . : 1
4 Foreground Interactive language processing Language. : ENGLISH
5 Batch Submit job for language processing Appl ID . : ISR
6 Command Enter TSO or Workstation commands TSO logon : ISPFPROC
7 Dialog Test Perform dialog testing TSO prefix: SYSADM
9 IBM Products IBM program development products System ID : P390
10 SCLM SW Configuration Library Manager MVS acct. : ACCT#
11 Workplace ISPF Object/Action Workplace Release . : ISPF 5.2
M More Additional IBM Products


Enter X to Terminate using log/list defaults

To allocate a new file, I shall navigate to 3 - Utilities Menu. I type the Option 3 on the screen and press enter.

   Menu  Utilities  Compilers  Options  Status  Help                            
------------------------------------------------------------------------------
ISPF Primary Option Menu
Option ===>
3

0 Settings Terminal and user parameters User ID . : SYSADM
1 View Display source data or listings Time. . . : 14:42
2 Edit Create or change source data Terminal. : 3278
3 Utilities Perform utility functions Screen. . : 1
4 Foreground Interactive language processing Language. : ENGLISH
5 Batch Submit job for language processing Appl ID . : ISR
6 Command Enter TSO or Workstation commands TSO logon : ISPFPROC
7 Dialog Test Perform dialog testing TSO prefix: SYSADM
9 IBM Products IBM program development products System ID : P390
10 SCLM SW Configuration Library Manager MVS acct. : ACCT#
11 Workplace ISPF Object/Action Workplace Release . : ISPF 5.2
M More Additional IBM Products


Enter X to Terminate using log/list defaults


On the Utilities menu, there are several options, 1 – Library, 2 – Dataset, 3 – Move/Copy and so forth. Select menu option 2 to allocate a new dataset.

   Menu  Help                                                                   
------------------------------------------------------------------------------
Utility Selection Panel
Option ===>
2

1
Library Compress or print data set. Print index listing. Print,
rename, delete, browse, edit or view members
2 Data Set Allocate, rename, delete, catalog, uncatalog, or display
information of an entire data set
3 Move/Copy Move, or copy members or data sets
4 Dslist Print or display (to process) list of data set names.
Print or display VTOC information
5 Reset Reset statistics for members of ISPF library
6 Hardcopy Initiate hardcopy output
7 Transfer Download ISPF Client/Server or Transfer data set
8 Outlist Display, delete, or print held job output
9 Commands Create/change an application command table
11 Format Format definition for formatted data Edit/Browse
12 SuperC Compare data sets (Standard Dialog)
13 SuperCE Compare data sets Extended (Extended Dialog)
14 Search-For Search data sets for strings of data (Standard Dialog)
15 Search-ForE Search data sets for strings of data Extended (Extended Dialog)


I shall just key in the name of the file SYSADM.MY.TEST.FILE and press enter. A new file would be created.

   Menu  RefList  Utilities  Help                                               
------------------------------------------------------------------------------
Data Set Utility
Option ===>
A

A
Allocate new data set C Catalog data set
R Rename entire data set U Uncatalog data set
D Delete entire data set S Short data set information
blank Data set information V VSAM Utilities

ISPF Library:
Project . . Enter "/" to select option
Group . . . /
Confirm Data Set Delete
Type . . . .

Other Partitioned, Sequential or VSAM Data Set:
Data Set Name . . .
'SYSADM.MY.TEST.FILE'
Volume Serial . . . (If not cataloged, required for option "C")

Data Set Password . . (If password protected)


ISPF makes life easy. ISPF windows and menus, lift the burden of having to remember TSO commands such as ALLOC, EDIT, MOVE, COPY and their complete syntax.

References

To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.