0% found this document useful (0 votes)
937 views132 pages

What On Earth Is A Mainframe

Uploaded by

Carlos Dantas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
937 views132 pages

What On Earth Is A Mainframe

Uploaded by

Carlos Dantas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 132

What on earth is a

Mainframe?

Quasar S. Chunawala
IT Professional, Pune, India
quasar.chunawalla@gmail.com

Copyright © 2013, Quasar Chunawala, Author


To my parents,
Shri. S.A. Chunawalla and Smt. Nafisa S. Chunawalla
Preface
To many people who are thrown to work at a mainframe computer on their first work
assignment, they feel lost. The hardware is a complete mystery. It doesn’t have a great
user-interface. Mainframe people seem to speak a completely different language. What’s
more, the books and manuals are incredibly hard to comprehend.

So, what’s covered in this book? We’ll introduce you to the hardware and peripherals of
a mainframe system. You shall become familiar with the jargon surrounding mainframe
computers. We’ll talk about the operating system, the software applications installed on
a mainframe computer. We’ll also talk about the different people who work on a
mainframe. We’ll train you on how to perform certain tasks on the mainframe – like
creating or editing files. We’ll educate you on how you can learn mainframe
programming.

So, who’s this book for? Whether you are a college sophomore or a graduate or a
working professional, it does not matter. This book is for everybody. A novice too can
read this book from cover-to-cover and become proficient with the mainframe
technology. If you own a personal computer at home, you can read this book.

Quasar Chunawala, Author


Table of Contents
1. What is a Mainframe computer? .................................................................................... 1
2. Operating System concepts, TSO and ISPF.................................................................. 10
3. Mainframe Information representation and storage .................................................... 21
4. Get your hands wet on a Mainframe ............................................................................ 46
5. The ISPF Editor ............................................................................................................ 72
6. The structure of Job Control Language (JCL) ............................................................ 81
7. The basic frame-work of JCL........................................................................................ 86
8. Multi – step Job streams ............................................................................................... 95
9. Submitting a job for execution .................................................................................... 104
10. Learn Mainframe programming ............................................................................... 113
1
What is a Mainframe Computer?
WHAT IS A MAINFRAME COMPUTER?

A Mainframe computer is a big computer. IBM builds mainframe computers. Today, a


Mainframe refers to IBM's zSeries computers. Big companies; Banks, Insurance
Companies, Travel and Retail Sector, Telecom Companies employ mainframes for
processing their business data. Today, thousands of people around the globe book
flights do electronic money transfers, swipe their credit-cards for purchases. These
transactions are processed in a snap by a Mainframe computer.

COMPANIES RELY ON MAINFRAME COMPUTERS

Today, all businesses trust Mainframe Computers to process their critical business data.
What distinguishes a Mainframe from other line-of-computers, its close cousins such as
Micro and Mini-Computers?

Available : Companies use mainframes for their mission-critical work. If a mainframe


system goes offline and access to the applications and data is affected, the company
would lose millions of dollars of business.

Mainframe computers are always available; they are up and running all the time. They
just don't fail. Once a Mainframe computer is started and powered on(IPL'ed), they run
for 5 to 10 years at a stretch, without failing. IBM ensures that mainframe systems are
available and running 99.999% of the time. Mainframe computers have very good up-
times. The Mean Time Between Failures(MTBF) ranges from several months to even
years.

Reliable : IBM boasts that you can bet all your money on a Mainframe, when it comes to
Reliability. Very often, you must have seen the horrific Blue-Screen of Death(BSOD) on
Desktop Computers and they crash! A mainframe computer reliably processes huge
volumes of commercial data, without crashing.
2|Page

Serviceable : Faults can be detected early on a Mainframe Computer. When some


components fail, some of IBM's systems can automatically call the IBM Service center.
Repairs can be done without disrupting the day-to-day operations. The RAS (Reliability-
Availability-Serviceability) features of a mainframe computer give it an edge over many
other computing systems.

ARE MAINFRAME COMPUTERS GOOD AT EVERYTHING?

Well, not quite. Mainframes are not good at number-crunching or don't do scientific
calculations. A Mainframe is not a Super-computer. You wouldn’t use a Mainframe
computer to calculate the value of Pi, up to 1000-decimal Places. Mainframe-Computers
are not meant for speed. They aren’t fast, rather they can process humungous data
reliably. You can't play games like Counter-Strike or Half-Life on a Mainframe.

Mainframe computers don’t have a beautiful user-interface like the PC at your home.
You wouldn’t find a desktop wallpaper or icons on a mainframe computer.

MAINFRAME HARDWARE

A Mainframe computer has processing units (PUs), memory, I/O channels, control-
units and peripheral devices. A processing unit (PU) is the brain of the mainframe
computer that executes instructions. A mainframe computer has many processors. The
total of all processor units (PUs) are inside a cage (frame) called the Central
Processing Complex (CPC).

There are specialized PUs capable of performing specific tasks. The main processors
are called the Central processor(CPs). There are PUs for encryption and
decryption(CPACF), Linux workloads(IFL), the co-
ordination of the system efforts(ICF), those that assist
the CP for any workload on the I-O subsystem(SAP),
spares that come in handy when a CP fails, others for
executing Java code(zAAP) and providing accelerated
DB2 performance(zIIP).

Buy a z10 Mainframe server and you’d get 12 central


processors, 12 IFLs, 12 ICFs, 6 zAAPs and 6
zIIPs(Source: IBM).

The CPC cage also contains main storage(RAM). A z10


mainframe can provide upto 384 GB of RAM memory.

A channel is an independent data and control path between I/O devices and the
Page |3

memory. Peripheral devices like disk-drives, tapes, printers, card-readers, card-punch


are connected to a mainframe computer using channels.
Because peripheral devices are relatively slower than the CPU, the CPU could waste
time waiting for data from a peripheral device. A I-O Control unit is a self-contained
processor and has logic to work with a particular type of peripheral device. Channels
connect to control units, which in turn manage the peripheral device.

Fig 1.2 Schematic structure of mainframe computer and external peripherals attached

A personal computer offers different ports to connect peripherals. It has USB ports, SCSI
bus. The Mac has high-speed firewire port. Likewise, on the mainframe, channels can be
OSA, ESCON or FICON. OSA Express channels are used to connect to standard
networking technologies such as LAN (Ethernet), Token Ring. ESCON and FICON
channels have fibre-optic cables.

MAINFRAME PERIPHERALS

Just as you use a keyboard, mouse and a CRT display to operate a Personal
Computer, in the early days you operated a mainframe computer by a terminal. A
4|Page

terminal had a display and a keyboard. A very popular terminal manufactured by IBM
in the 70’s was the 3278 Terminal.

Fig 1.3 An IBM 3278 terminal capable of displaying 24 rows and 80 columns

Terminals connected to a mainframe computer remotely, over a network. They used the
IBM 3270 protocol for communication. IBM no longer manufactures terminals, instead
you use a PC running a software that mimics the terminal. Terminal emulators such as
the IBM Personal Communications are quite popular.
Page |5

Fig 1.4 IBM 3380 DASD Disk drive assembly

Storage devices such as Magnetic Disk drives are used as secondary memory. IBM
uses the term DASD (Direct Access Storage Device) pronounced as dazz-dee for
hard-disks. Disk drives support random access to data. IBM 3380 and 3390 DASD
models are widely in use. The picture below shows a 3380 DASD assembly(Source:IBM
Archives).

Tape drives are also used for storage. A Tape drive allows sequential access of data.
Very large files can be stored on tape-drives. Tape drives are often used for a backup of
data. IBM continues to innovate the tape drive technology. IBM 3480 tapes were very
6|Page

popular in the last century. The picture below shows two 3480 tapes (in the front) and
two 3420 tapes (the tape reels at the back). Tapes now come in a square cartridge
form, instead of a tape reel.

Fig 1.4 IBM 3380 DASD Disk drive assembly

Punched Cards (Hollerith Cards) although obsolete, have been used over a century for
recording information. A punched card was a stiff paper that represented information by
the presence or absence of holes. Punched cards were used by Joseph Jacquard in
the early 19th century in textile looms. By using a particular punched card, you could
select a weaving pattern.

Herman Hollerith proposed the use of punched cards to store information about US
nationals during the 1890 census. Jacquard cards were read-only. Hollerith envisioned
that punched cards could be used as a read/write technology. A key-punching
machine could be used to punch data such as age, sex or marital status of the citizen. In
the figure 1.5 below, you see the operators preparing data for the census.(Source:
Computer Science Labs).

By the early 20th century, punched cards began to be used everywhere in the United
States. Your gas bill would arrive every month with a punched card, that stored the
customer name, the address, the bill amount and the due-date. In the 20th century,
punched cards were used as legal documents such as US government checks.
Page |7

Hollerith founded a company, The Tabulating Machine Company(1896), which after a


few buyouts, became known as International Business Machines(IBM)(1911). IBM
manufactured the standard 80 column punched card. A deck of cards were fed through
a hopper into a card-reader. Output data could be punched onto cards using a card-
punch.

Fig 1.5 Operators preparing punched cards for the census using a keypunch machine

The photograph below Fig 1.6 (Source: IBM Archives) shows a standard 80-column
IBM card. A legacy of 80-column card is even today terminals connected to a mainframe
server have a display of 24 rows x 80 columns. The columns 73-80 contained
sequence numbers and were used for sorting the punched cards.

Fig 1.6 Standard 80-Column IBM Punched Card


8|Page

MAINFRAME COMPUTER INDUSTRY AND THE PEOPLE INVOLVED

To oversee the running of a mainframe computer, you need to hire professionals called
System Operators(Sysops). Mainframe sysops have good knowledge of the
mainframe architecture and the operating system. The operating system on the z10
mainframe computer is the zOS (pronounced as zee-OS). A Mainframe operator starts
(IPL – Initial Program Load) or shuts down the mainframe and various
regions(applications). He must monitor workload on the system and reply to any
messages. He can issue commands to vary various peripheral devices online or offline.

Just as MS-DOS or Linux offer a command-line interface, the zOS too has a command-
line, at which the system operator issues MVS commands to start or shut-down
applications(e.g. START DB2), to monitor the workload(DISPLAY A,L) etc. Console is
another term for the command-line interface of zOS. The figure below shows how the
console looks.

Fig 1.7 zOS master console

Application programmers design and build application software that runs on


Mainframe computers for companies. First, the customers (end-users) specify the
business requirements. Business analysts gather these business requirements and with
the experience they have acquired, translate it into functional and technical requirements
Page |9

and give a briefing to the application developers. The application developers then create
technical designs, write code in High-level languages such as Cobol, C/C++, PL/1 and
test it.

System programmers perform hardware-software upgrades, capacity planning and


trains other sysops. He is a watch-dog. He installs the operating system. He applies
patches (patches are called PTFs on mainframe). He also maintains other system
software or products running on the mainframe.

CONNECTING TO A MAINFRAME COMPUTER

Typically at a customer site, mainframe servers are generally housed in a large area of
building space. This is called the data center or the raised floor. People around the
world connect to the mainframe computer, remotely over a network, from their work-
place or home, using the keyboard and the dumb-terminal, or a PC running a software
that pretends to be a dumb-terminal. Gee, you don’t have to sit physically near a
mainframe box to do your work. This is how the Mainframe Screen looks like, when you
first connect to it –

Fig 1.8 zOS mainframe screen displaying various menu options


10 | P a g e

2
Operating System concepts, TSO
and ISPF
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).

Fig 2.1 IBM 701 Computer


P a g e | 11

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.

Fig 2.2 A GANTT chart showing IBM 701 computer setup time

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
system 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
queue would automatically start. Programmers were thrown out of the computer rooms
12 | P a g e

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.

Fig 2.3 Memory map

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.

Fig 2.4 How multi-programmed OS works


P a g e | 13

I-O CHANNELS AND INTERRUPT HARDWARE

The new mainframe computer Systems/360 had an I-O subsystem. 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.

Fig 2.5 I-O subsystem in System/360


14 | P a g e

CHANNEL PROGRAM AND CHANNEL COMMAND WORDS (CCWs)

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.

Fig 2.6 How access methods prepare a channel program

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
P a g e | 15

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.

Fig 2.7 STARTIO command processing

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.

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
16 | P a g e

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.

Fig 2.8 TSO command-line interface

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).
P a g e | 17

Fig 2.9 TSO LISTCAT Command

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
18 | P a g e

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.

Fig 2.10 Allocating a file using TSO software

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.

Fig 2.11 ISPF Primary Menu


P a g e | 19

ISPF is equivalent to a Graphical User Interface (GUI) on the Mainframe. ISPF has
window-like panels. The figure 2.11 shows, what an ISPF window looks like.

Fig 2.12 ISPF Menu option 3 is the utilities menu

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 a menu, just key in the appropriate option and press the
return key. Look at figure 2.11.

As an example, to create a new file on the mainframe system, I must navigate to 3 -


Utilities Menu. I type the Option 3 on the screen and press the <enter> key. Refer to
figure 2.12.

Further on the Utilities menu, there are several options, 1 – Library, 2 – Dataset, 3 –
Move/Copy and so forth. I may then select the menu option 2 and press <enter> to
allocate a new dataset. Refer to the figure 2.13.
20 | P a g e

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

Fig 2.13 The menu option 2 under utilities ISPF Menu

ISPF navigation is quite simple. You can literally jump to any ISPF menu directly. For
example, instead of typing 3 on the main menu followed by 2 on the utilities panel, you
may just type =3.2 and press the <enter> key to directly jump to the allocate menu. This
is called the jump facility.
P a g e | 21

3
Mainframe information
representation and storage
HOW MAINFRAME COMPUTERS STORE DATA

On computers, data is stored in the form of bits – 0s and 1s (binary). Characters like
A,B,C,...,Z are formed with 8 bits called as Bytes. When you press a key on the
keyboard, the key emits out eight bits from the cable.

Every key is represented with a unique combination of 0s and 1s. Because, we use 8
bits to store a character, a total of 2^8 = 256 patterns are possible. IBM Mainframe’s
designers assigned a unique 8-bit pattern to each character. This scheme of
representing characters and data in mainframe computers is called Extended Binary
Coded Decimal Interchange Code (EBCDIC). Every character occupies storage of
one byte space in computer memory.

FIELDS, RECORDS, FILES AND DATASETS

Financial institutions like banks are computerized. A bank may store data of its
customers on a central computer. This would include details such as the full-name of
the customer, his residential address, his social security number, his contact details and
his account number. Data such as the customer name consist of a sequence or a group
of characters. A group of characters that represent a data item is called a field. For
example, the customer name is one field, customer address is another such field and so
forth.

Associated fields such as the customer name, address, the account number etc. about
an entity put together make up a record. A record represents data for a single instance.
22 | P a g e

A customer record tells you everything about one customer. A record may be divided
into several fields.

A record has a length. Assume that the customer name field can be 10 characters long,
the customer address can have upto 30 characters, the contact details field can span 10
characters, the social security number 09 digits and the account number upto 21 digits.
Recollect that each character on the mainframe computer occupies one byte of memory
space. The length of each customer record would then be the sum of the fields’ sizes, 30
+ 10 + 10 + 09 + 21 = 80 bytes. Hence, the record of a customer would occupy 80
bytes in computer storage.

If a collection of records are stored together, say 1000 customer records of the bank, it is
called a file. A file is then, just a sequence of records. IBM mainframes use the term
dataset instead of file.

Generally, datasets (files) are stored on computer storage devices. On the mainframe,
there are two storage devices commonly used – disk and tape.

Fig 3.1 The concept of field, record and files (datasets)


P a g e | 23

MASS STORAGE DEVICES

Mass storage devices are used to permanently store data. They are non-volatile. It
does not lose its contents even when the electrical power is cut-off. Mass storage
devices can store humungous volumes of data. They have high capacity.

The data stored on a storage device can be accessed by two methods – Sequential
Access and Direct (Random) access.
SEQUENTIAL ACCESS

Sequential access means that the mainframe system must search the storage device
from the beginning, till the desired data is found. This is like playing a Bollywood music
cassette tape on your Sony Walkman. The audio cassette tape of the Hindi movie film
Jab Tak Hai Jaan had five songs – Challa ki, Saans me teri sung by Shreya Ghosal,
Heer heer Harshdeep kaur, Jiya Re by Neeti Mohan and Jab tak hai jaan title track by
Neeti Mohan. Now, if you had to listen to JTHJs title track, you will start at the first song
and must go past the second, third songs and so forth, till you reach the last song. The
most common storage device that allows sequential access is a Magnetic Tape.

DIRECT (RANDOM) ACCESS

Direct access implies that the mainframe system can directly locate the desired data on
the storage device. This is like reading a topic in a reference book. If I would like to read
about optical isomers in Organic Chemistry’s book written by Morrison Boyd, I’d check
the entry optical isomers in the index. In the index, the entry optical isomer had the page
number 257 against it. I can directly jump to page 257 of the book and read about
optical isomers at length. I don’t have to read the book from cover-to-cover. The most
common device that allows direct access is a Magnetic Disk.

MAGNETIC RECORDING AND PLAYBACK

Faraday’s laws of electro-magnetic theory in Physics say that when a magnet is moved
past a magnetic field, it can be magnetised, usually created by an electro-magnet.
Like-wise, when a coil (wire) is moved past a magnetic field, it induces an electric
voltage (signal) in the coil.

Usually, the surface of a storage media is coated with a magnetic material like Ferric
oxide. At an atomic level, the oxide coating has several tiny poles (magnets) which are
randomly oriented. The head is an electro-magnetic coil that receives computer data
(Bit 0 or 1) in the form of electric pulses. The electro-magnetic coil creates a magnetic
field around it.
24 | P a g e

While recording data, the surface of media is moved past the head (coil). Variations in
the electric pulses cause variations in the magnetic field created by the head. The tiny
poles (magnets) on the surface of the storage media are magnetised (aligned) and they
orient themselves N-S or S-N depending on the bits 0 and 1. Playback is the reverse.
N-S or S-N orientation of the poles of the storage media are sensed as bits 0 and 1 by
the head.

MAGNETIC TAPE

A standard magnetic tape consists of a ½ inch wide plastic ribbon coated with Ferric
oxide magnetic substance. On the mainframe, each character (A-Z,a-z,0-9) is
represented by a unique 8-bit pattern(1 byte). The magnetic tape has eight tracks to
store eight bits for a character + one track for the parity bit which is used for error
detection. Look at the figure 3.2 below. It illustrates how the string HELLO will be stored
on a magnetic tape.

Fig 3.2 How information is stored on a magnetic tape

Data sequentially can be stored and retrieved sequentially from a magnetic tape. It is
not possible to get quick access to data. However, magnetic tapes are very cheap
compared to other storage media. Large amounts of data can be stored on tape. It is the
preferred medium for taking backups and archiving old data.

BLOCKS AND INTERBLOCK GAP

When you visit the mall to buy groceries for the coming month, you usually buy grain,
cooking oil, flour and other non-perishable goods in bulk. In a single trip, you’d purchase
items in sufficient quantity, so that stocks last at-least a month and you don’t have to
make a second trip. It is economical.

A block is a contiguous group of records on a storage device. Media such as disks or


tapes are said to be block-oriented devices as opposed to record-oriented. On these
P a g e | 25

devices, a group of records are stored together as a block. The below figure 3.3
illustrates, how records are blocked. Consecutive blocks have a gap between them
called the Inter-block gap (IBG).

Fig 3.3 Block and Inter-block Gap

On the mainframe system, a block is the basic unit of data transfer. During a single
READ or WRITE operation, 1 block is transferred from the storage device.

Blocks are described by their block size. It is upto the programmer to determine the
block’s size (length). Say, I choose a block size = 800 bytes while storing customer
records. Each customer record is 80 bytes long. Then, the number of records in each
block is,

Blocking Factor = (Total Block-size / Record Length)


= (800/80) = 10 records/block

The blocking factor is 10 records per block. As a result, you end up transferring 10
customer records in a single READ or WRITE. This indeed helps. Say, you were
generating monthly account statements of all the customers. Having processed one
customer record, the probability or likelihood of processing the neighbouring records
(customer 2, customer 3, … and so forth) is very high. It would relatively cheap to get a
block of 10 records in a single READ, rather than executing ten READs and get only one
record at a time.

There’s a trade-off between performance and data-transfer time. One must realize
that a small block size degrades the performance. Choosing a very large block size shall
boosts the performance, but takes a toll on the amount of time required to transfer the
data. Choosing the optimum block-size for your datasets is therefore important. Many
mainframe shops install a software product that determines the best block-size for your
file.
26 | P a g e

Advantages of blocking
1. Fewer I/O operations are needed because a single READ moves an entire block
containing several records.

Disadvantages of blocking
1. Tiny software programs called access method routines block and de-block the
data. This is an overhead.

MAGNETIC DISK

A magnetic disk resembles a phonograph vinyl record. Here, the tracks are laid out in a
circular shape. A single disk known as a platter has several concentric tracks. Data is
stored on both the sides of the platter.

In IBM 3390 DASD drives used currently in the modern mainframe systems of today,
eight such disks are stacked to form a disk pack or volume. When the drive is in
operation, these platters revolve at a very high speed around an axis called the spindle
(not shown the diagram).

Fig 3.4 Magnetic Disk Unit Organization

An arm (actuator) has READ/WRITE heads. There is one READ/WRITE head for each
surface of a platter. But, how is a particular track located? To seek the desired track, the
arm (actuator) moves the READ/WRITE heads from the outermost track towards the
center of the disk. Note that, all the READ/WRITE heads move as one unit. So, if the
arm moves the head to Track 150, all the READ/WRITE heads are positioned at Track
P a g e | 27

150 on their respective surfaces. The same track on each of the surfaces can be
imagined to form a virtual cylinder.

Eight disks have 16 surfaces. One of the surfaces is used to record control information.
As there are 15 surfaces on which data is recorded, 1 cylinder is equal to 15 tracks of
storage space.

The READ/WRITE head assembly travel as a single unit and are capable of transferring
an entire cylinder without any movement. As a consequence, storage space on the
DASD drive is not filled up surface by surface. Instead, it is filled up cylinder by cylinder.

FORMING DATASET NAMES

On a mainframe computer, there would be thousands of files (datasets). There must a


unique name for every dataset. Mainframes support very large dataset names. On
mainframes, a dataset name can be 44 characters long in this format:

XXXXXXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX

A dataset name is made up of several segments or qualifiers. Each segment can be


upto eight characters in length. The qualifier must start with a capital letter (alphabet).

Generally, it is a good practice to give meaningful names to your dataset. For example, if
you are storing Employees data in a file, you can name it as EMPLOYEE.DATA.

The MVS Operating System keeps track of groups of datasets by referring to their
names, which are called qualifiers. The first part of the dataset name is called High-
level Qualifier (HLQ).

Generally, when you access or log-in to Mainframes, you are given a TSO USER-ID, just
as on Windows PC, you need a user-id to login. Most professionals or software
engineers who work on a mainframe have a TSO user-id and password to access the
mainframe computer.

When you use a TSO-id, a special requirement applies to most datasets (files) that
belong to you. Suppose your TSO-id is AGY0157. Then all your datasets should have
the High-level qualifier AGY0157. Thus, the name of the files that belong to you should
start with AGY0157. For example, the name of Employees file would be
AGY0157.EMPLOYEE.DATA.

In fact, you can identify the files that belong to you, your application or your system by
looking at the High-level Qualifier of the file.
28 | P a g e

Security software products like RACF, CA TOP-SECRET are generally installed at a


mainframe shop. These products can be used to control access to files. For example,
you may grant read-only access to the file AGY0157.EMPLOYEE.DATA to others. Thus,
RACF would then prevent others from making changes to your dataset.

SEQUENTIAL DATASETS

Sequential datasets can be likened to a music cassette, on which songs are stored one
after the other. When you play the cassette, you listen to music; one song and then the
next song and so on … till you reach the end of the cassette. You cannot directly jump-
to, or fly to the fifth song, or last song. Thus, a music cassette tape is accessed
sequentially.

On the same lines, records in sequential files are stored one after the other in a series.
In a sequential file, you need to read through all the records one by one, step-by-step till
you reach the desired record.

Thus, a sequential dataset is the simplest form of dataset. On the mainframe zOS
Operating System, sequential dataset is known as PS dataset, PS stands for Physical
Sequential.

Fig 3.5 A schematic of a PS (Physical Sequential) dataset


P a g e | 29

CREATING A NEW DATASET

ISPF organises most common functionalities that you need to perform on Mainframes –
like creating a new file/folder, editing a file, searching for files, taking backup etc.
in the form of menus, just like a Nokia Cellular Phone.

To create a new file, you have to go to the menu 3.2 in ISPF. You enter the dataset
name here on ISPF Screen, select the option ===> A (Allocate) and press <enter>.

Fig 3.6 Creating a new dataset in ISPF

LOCATION OF A DATASET

On a mainframe system, every disk volume or pack is identified by a unique code of


six-characters. This is called the volume serial. For example, the mainframe system I
am connected has several 3390 DASD volumes S4RES1, S4RES2, OS39M1, S4DB21
and so forth. Look at the figure 3.7 below.
30 | P a g e

Fig 3.7 List of DASD Volumes mounted on the mainframe system

At many mainframe shops, groups and subgroups of storage devices are also assigned
a generic name. For example, all the DASD volumes could be together collectively
assigned a generic name SYSDA.

Fig 3.8 Request to create a mainframe file on a specific volume


P a g e | 31

All the tape cartridges could be collectively assigned the generic name TAPE. The
generic name for a group of devices is called UNIT.

So, while requesting a new mainframe dataset you have the liberty to specify a
VOL=SER= (volume serial). Have a look at the figure 3.8. I could specify the volume
serial OS39M1. If your request is not volume-specific, the zOS creates the mainframe
file on any one of the available volumes.

Fig 3.9 Concept of Volume and Unit

PRIMARY AND SECONDARY SPACE

The zOS operating system is a miser. It doesn’t give away a single byte of memory for
free. When you request a new mainframe file, you must declare and announce, how
many bytes/tracks/cylinders of storage space do you need for your file?

These space projections (how much space would the dataset need) of the new dataset
are in terms of primary space and secondary space. Let’s say, I request 10 tracks of
primary space and another 10 tracks of secondary space for my new dataset
SYSADM.EMPLOYEE.DATA. Take a look at figure 3.10.

To honour your request, the zOS operating system sets aside ten tracks of primary
space for your dataset on the storage device. Once this request is satisfied, you’d get a
‘Data set allocated’ message on your screen.

As time passes, you store more and more data in your file. Ultimately, the dataset
becomes full with data and it has no empty space left. Now, the secondary space
comes into picture. The zOS allocates ten tracks of secondary space to the dataset. The
dataset is then 10 + 10 = 20 tracks large. The dataset is said to extend itself. Over a
period of time, if the dataset again becomes full, the zOS allocates yet another 10 tracks
of secondary space. So, it becomes 20 + 10 = 30 tracks big. This way, the zOS allows
upto 15 extents of the secondary space.
32 | P a g e

Thus, when you create a new dataset, the zOS tries to fulfil the primary space. If the
dataset fills up, zOS tries to allocate additional space in increments of the secondary
space. A dataset can extend upto 15 times the secondary space.

Fig 3.10 Primary and Secondary Space

FIXED AND VARIABLE LENGTH FILES

A fixed length file is the one, in which each record occupies the same fixed number of
bytes. For example, in the INPUT DATA file below, each record is 50 bytes long. Every
record has the same fixed length. The SYSADM.INPUT.DATA file is then said to be
fixed length. The record format is fixed – FB.

A variable length file is the one, in which the records vary in length. As an example,
there is a possibility that the customers of a bank might hold two or more accounts. In
such cases, the customer record is 100 bytes large, whereas if he has just 1 primary
account, the record would be 80 bytes large. Hence, not all of the records in the
customer file are of the same length. The customer file would then be a variable length
file. The record format would be variable – VB.
P a g e | 33

Fig 3.12 FB Record format – every record is 50 bytes.

Take a look at the figure 3.12 below. I have entered Record Format as FB, Record
length = 80 bytes and block size = 800 bytes for the SYSADM.EMPLOYEE.DATA file.

Fig 3.12 Record Format can be FB or VB


34 | P a g e

PDS (PARTITIONED DATASET)

When you create a sequential dataset (PS), it occupies a large amount of storage space
(minimum 50,000 bytes). Sometimes for doing trivial tasks, storing only a few records,
you would not be utilising the entire space available in a sequential file. Thus most of the
space in the Sequential file is wasted and is blocked.

IBM provides a way to split-up or partition the space in a sequential data-set. IBM
Software engineers invented the Partitioned Dataset, often called PDS. Each part is
called a Member. A Partitioned Dataset can have many members (parts). Each
member behaves like a sequential file on its own.

How does the PDS then keep track of its members? A Partitioned Dataset (PDS)
includes a directory (like a telephone directory), which is a diary or journal, where zOS
Operating system keeps track of the members in a PDS. The members of a PDS can be
scattered hap hazardly anywhere in the vast computer storage space. Well-then, you
consult the directory to find out the members in the PDS. Just as in a book, the index
tells you, the keyword you are looking for and the page no. where it can be found, the
same way, the directory tells you the member name and the computer memory address
where you can find it. Thus, the directory maintains the list of member-names and
pointers to the actual physical place in computer memory, where they are stored.

Not just this, but the directory also keeps track of its statistics, when the member was
created, when was it last modified/viewed by somebody, how much space it occupies,
the TSO user-id that created it amongst other things

On the Windows Operating System, we generally keep related files together in a folder.
On the same lines, you keep related members together in one PDS. Thus, a Partitioned
Dataset on mainframe computers is a counterpart of folders on Windows OS. Folders
contain many related files. A PDS contains many related members.

When creating this special type of file – a Partitioned Dataset, you need to determine,
how big its directory is going to be. The bigger the directory, the more no. of partitions
(members) it will support. You express this in terms of Directory Blocks. Generally, 1
directory block can store information of about 5 members. The directory size always
remains fixed. The directory can’t grow bigger. So you must carefully specify the
directory blocks and you have to do it in advance.
P a g e | 35

Fig 3.13 Schematic of a Partitioned Dataset (PDS) on disk

To sum up, a Partitioned Dataset (PDS) is a specialised type of sequential file, which is
divided into members, each member being a sequential dataset by itself. Thus, a PDS
acts like a library which houses several related files.

SPECIFYING WHETHER FILE IS SEQUENTIAL OR PARTITIONED

A sequential PS File doesn’t have any partitions or members (0 members). So, it doesn’t
have a directory to look upto. Thus, the space allocated to a directory, in terms of
Directory Blocks for a Sequential PS File is Zero (00).

On the other hand, for Partitioned Dataset (PDS), it can contain 1 or more members. So,
it needs a directory to record the where-abouts (location) of its members, which are
scattered throughout the memory randomly. You need to allocate space in terms of
Directory Blocks to a Directory in Partitioned Dataset (PDS). Thus, Directory Blocks
for a PDS should be some finite number, say 5 blocks, or 10 blocks.

Suppose you are creating a new File SYSADM.EMPLOYEE.DATA. You specify the
Directory Blocks on the ISPF Menu 3.2 screen, as follows -

1. If you want the file SYSADM.EMPLOYEE.DATA to be a Physical Sequential File


(PS), then fill the Directory Blocks field = 0.
36 | P a g e

Fig 3.14 Allocating a Sequential Dataset, Directory Blocks = 00

2. On the other hand, if you want the file SYSADM.EMPLOYEE.DATA to be a


Partitioned Dataset(PDS), having 1 or many members and a directory, specify
Directory Blocks field = 1,2,3 or ...(any finite value) blocks. In the figure below, I have
put Directory Blocks = 10 Blocks.

FINDING (LISTING) ALL YOUR DATASETS

You want to find and locate the files you’ve stored data in. Finding the file on zOS
Operating System is done using, ISPF Menu 3.4, called Dataset List Utility. Go to
ISPF Menu 3.4 screen and type the name of the dataset that you want to search and
press enter key.
P a g e | 37

Fig 3.15 Allocating a Partitioned Dataset, Directory Blocks = 10

For example, if you want to find the file SYSADM.EMPLOYEE.DATA, then type
SYSADM.EMPLOYEE.DATA in Dsname field and press <enter>. Take a look at figure
at figure 3.16.
38 | P a g e

Fig 3.16 Finding (listing) all datasets using DSLIST Utility

On pressing <enter>, you would find list of files displayed before. Note that, Dataset List
Utility (DSLIST) works by searching for all files that match a pattern. So, when you type
SYSADM.EMPLOYEE.DATA, what you actually specify is a pattern.

All files matching this pattern will be displayed. So, if there is a file –
SYSADM.EMPLOYEE.DATA.MASTER, it also matches the pattern. Thus, it will also be
listed.

Fig 3.17 Datasets matching the pattern SYSADM.EMPLOYEE.DATA


P a g e | 39

In fact, if you don’t know the exact name of your file, you can just specify the pattern
followed by a wild-card. Say, for example, if you want to search for all the files starting
with SYSADM.DEMO.something, then you can specify it as SYSADM.DEMO.*.

Fig 3.18 Search datasets starting with SYSADM.DEMO.*(wild-card)

When you press Enter, you would get the list of all datasets (files), whose names start
with SYSADM.DEMO like in the Figure 3.18.

LOOKING-UP MEMBERS IN A PDS DIRECTORY

To see the directory of a PDS Library, you need to type M (Member) against the name
of the Partitioned Dataset (PDS). The M Command tells the zOS Operating System to
display the directory of the Partitioned Dataset (PDS).

Suppose, you would like to see the directory (list of all the members) of the Partitioned
Dataset (Library) SYSADM.DEMO.SRCLIB. Then, type an M against its name in the
DSLIST Utility ISPF Menu 3.4 screen. Refer to the figure 3.19.
40 | P a g e

Fig 3.19 List of datasets beginning with SYSADM.DEMO

Fig 3.20 Looking up members of a PDS using M (Member) command

Upon pressing <enter>, you get to see the directory of the Partitioned Dataset (PDS)
SYSADM.DEMO.SRCLIB – you can see the entire list of members in the PDS.
P a g e | 41

Fig 3.21 The directory (list of members) of SYSADM.DEMO.SRCLIB Partitioned dataset

Generally, you would keep your programs, jobs, REXX scripts assorted in libraries or
Partitioned Datasets (PDS). Here, I have stored all my source Cobol Programs in this
library.

CODING MEMBER NAMES OF A PARTITIONED DATASET

To refer to a member of a Partitioned Dataset in JCL, you code the dataset name with
the member name in parenthesis. Here, is how you code my dataset name in JCL, when
I have to refer to a job named PROGRAM1 in my SRCLIB (Source Library)
SYSADM.DEMO.SRCLIB(PROGRAM1).

OPENING AND EDITING A SEQUENTIAL FILE

Over the next chapters, you’ll learn how to use JCL to run programs, read file, send
output to printer, create and delete files. But, before this you need to key in some data
into your mainframe computer file. This data consists of 80-byte records.

After creating a file, you need to an ‘E’ against the file-name to edit the file. Let’s assume
that you wanted to key in Employee Data in Physical Sequential file –
SYSADM.EMPLOYEE.DATA. After you’ve found the file using ISPF Dataset List Utility
42 | P a g e

3.4, just type E against that dataset and press enter.

Fig 3.22 Opening a file in edit mode

Just as on Windows, the default editor in Notepad, typing E against the dataset name,
causes the file SYSADM.EMPLOYEE.DATA to open in the editing mode. The editing
mode allows you to change the contents of the file – add new data, modify the data, or
delete the data. On the other hand, you can also open the file in View Mode (type V) or
Browse Mode (type B). View Mode or Browse mode is a read-only mode (You cannot
change the contents).

Generally, when you open files in the production environment (Files which are being
used, when the mainframe application is running live), it’s a good practise to open them
in read-only mode.

Initially, the file SYSADM.EMPLOYEE.DATA is empty. When you open it, in edit mode,
it looks like in the figure 3.23.

You can now key in your data in the file and save it by typing the SAVE Command on
the command line field, as shown in figure 3.24.
P a g e | 43

Fig 3.23 After SYSADM.EMPLOYEE.DATA file is opened for editing

Fig 3.24 SAVE command to store(save) data in the file

EDITING A PARTITIONED DATASET (PDS)

As an application programmer or a production support analyst, you are likely to work


with partitioned datasets day in, day out. At a mainframe installation, partitioned datasets
(PDS) act as an inventory for source programs, cobol copybooks, CICS maps, Rexx
scripts, jobs, catalogued procedures, DCLGENs and many other software components.
44 | P a g e

From the list of datasets on the dslist utility 3.4, select the partitioned dataset you want to
edit. For example, I have to write a new source program in Cobol in my PDS
SYSADM.DEMO.SRCLIB. Type M (Members) against the dataset name and press
<enter> to view the directory (list of members) inside the PDS. Have a look at figure
3.25.

Fig 3.25 Viewing the members of a Partitioned Dataset

I shall write a new program called MYPGM.

Fig 3.26 Creating a new member in a PDS


P a g e | 45

To do so, I must create a new member inside the library. Type the command S
<member> E and press the <enter> key to create a new member. I typed S MYPROG E
and pressed <enter>. Look at figure 3.26. This creates the member MYPROG. While
coding the member name in a JCL, it will be referred to as
SYSADM.DEMO.SRCLIB(MYPROG).

Say, I would like to make changes to the program PROG01. To edit an existing member,
you type E (Edit) command against the member name and press <enter>.

Fig 3.27 Editing the members of a PDS


46 | P a g e

4
Get your hands wet on a
Mainframe
3270 TERMINAL EMULATOR

In the 1970’s, IBM introduced computer monitors or terminals that could be connected
to a mainframe for visual output and input. There were several models – the most
prominent one was IBM 3278 video terminal. These display terminals are no longer
manufactured.

A terminal emulator is a software program that emulates the IBM 3278 video terminal.
It can be installed on your (Windows/Linux/MAC) PC. The 3270 emulator acts like a
web-browser on the mainframe. With the emulator software, you work your way around
the Mainframe Computer and do common day-to-day tasks, such as creating new files,
editing files, deleting files, copying data. A photograph of a terminal emulator –
VISTA TN3270 software is shown below in figure 4.1.

Starting a New Session


The first thing to do is launch the terminal emulator on your PC and connect to the
mainframe server. This establishes a new session on the mainframe and allows you to
perform tasks on a Mainframe.

Logging Off
It is very important that, you log-off the Session, when you are done with your work on
the Mainframe. It is not acceptable, that you just close the Terminal-Emulator Window.
P a g e | 47

Fig 4.1 A 3270 terminal emulator – VISTA TN3270 by Tom Brennan

Keyboard Lock
The transaction that takes place between a user (indirectly refers to terminal emulator)
and the mainframe computer is conversational. When a user enters an input on the
terminal emulator and presses the return key to execute, the 3270 emulator software on
your PC sends out a stream of data to the mainframe computer over a network (LAN
Intranet/Internet). The 3270 terminal emulator freezes and would not accept any further
inputs till it receives a response from the mainframe server. The mainframe computer
processes your instructions and replies back with an output. Meanwhile, there is an X in
the bottom left-hand corner of the screen. Look at figure 4.2 below.

Another event that frequently happens, is the Terminal-emulator may stop responding to
your Key-Strokes and goes into a XMIT-Lock Mode. This happens when your cursor is
incorrectly positioned at a place (field) on the Screen, where you are not supposed to
type. Press the Escape Key, several times, or try Ctrl+R to Reset the Emulator.
48 | P a g e

Fig 4.2 Terminal in a locked state (See X at bottom left corner)

User Prompt
On the mainframe, notifications and messages such as alerts, warnings or severe errors
require your acknowledgement. The 3270 console often displays three asterisk symbols
* * *, prompting the user that it needs your attention. You must acknowledge by pressing
any AID key (attention identifier) like the <enter> key or PF1 to PF12.
P a g e | 49

Fig 4.3 Three asterisks * * * that prompt the user to press <enter>

Beware of the Over-write Mode


Unlike most word-processors which operate in Insert-Mode, the normal (Default) mode
of operation of a Terminal Emulator is Over-write Mode. Let's say, there's a string of
Text AAAABBBBCCCC, which you want to be modified to AAAADDDDCCCC.

AAAABBBB|CCCC Cursor is between B and C

AAAA|CCCC Press Backspace four times, to erase BBBB

AAAADDDD| Enter DDDD

Quite the opposite of what you would expect, the CCCC gets over-written by the new
text DDDD.
50 | P a g e

Fig 4.4 Standard 104-Key Keyboard with PF Keys

Keyboard-Mapping
A Terminal-Emulator has a Keyboard-Map. This map essentially tells you, the actions
assigned to a particular key on the keyboard. It answers the question, “What happens
when you press a certain key on the keyboard?”.

The keyboard map of a terminal emulator is shown in the picture above.


With some terminal emulators like IBM Personal Communications, the standard
carriage return function is mapped to the Ctrl key. Various other terminal emulators
map the carriage return to the Enter Key. Make yourself familiar with, which key causes
a newline.

On the Mainframe, the Function-Keys are known as Program-Function (PF) Keys. It is


P a g e | 51

possible to assign TSO and ISPF commands to a PF-key. They behave like shortcut-
keys.

Terminal Screen
Most terminal emulator applications are equipped with five different display modes. Each
mode shows a different number of lines (rows) and columns on the screen. In Mod-2
operation, the terminal emulator is capable of displaying 24 horizontal lines(rows) x 80
vertical columns. Historically, these are the remnants of punched-cards.

Fig 4.5 Different Modes – Mod2, Mod3 and Mod 4

In the early days of System/360, data and programs were stored on punched cards
(founded by Herman Hollerith). A Punched-Card had 24 rows and 80 Columns. Data
was recorded on punched cards by punching holes using a Key-Punch Machine.
52 | P a g e

Fig 4.6 An 80 column punched card

LOGGING ON TO THE MAINFRAME

The first step is to run the 3270 terminal emulator on your computer. What I have on
my computer and would suggest to beginners, is to install a terminal emulator called
Jagacy 3270. You can get a free distribution of the Jagacy 3270 emulator at the vendor
website http://www.jagacy.com on the Internet.

Fig 4.7 Connecting to the mainframe server

Connect to the mainframe server by entering its IP address in the dialog box. For
example, I have entered fandezhi.efglobe.com. The port is the standard telnet port 23.
Refer to the figure 4.7.
P a g e | 53

Fig 4.8 Starting a new TSO Session

Generally, when you connect to the mainframe, you’d get a welcome screen. From
here, you may logon to different regions. You usually type TSO to start a new TSO
Session and press enter. Refer to figure 4.8.

Fig 4.9 Entering the TSO user-id


54 | P a g e

Fig 4.10 Entering the TSO password

When you start the TSO-Session, enter your TSO User-ID. Enter your TSO user-id as
shown in Figure 4.9. After you type the user-id and press enter, key in the password as
shown in Figure 4.10.

STARTING ISPF

After authentication, the TSO software starts loading. When the loading is complete and
the dust settles, the TSO READY prompt is displayed on the screen.

Fig 4.11 Starting ISPF User Interface


P a g e | 55

Type ISPF at the READY prompt and press <enter> to start the ISPF user-interface.
Look at the figure 4.11 above.

ISPF MENU STRUCTURE

ISPF organizes common tasks in the form of menus. You must type the number of the
menu option to select it. For example, to select Settings from the main menu, type 0 on
the command line and press enter. To select Utilities from the main menu, type 3 on the
command line and press enter.

Look at the ISPF Menu structure in figure 4.12. The Utilities Menu(3) again has sub-
menu’s under it Library(1), Dataset(2), Move/Copy(3), Dslist(4), … so on and so forth.
ISPF Menu options can be concatenated.

Fig 4.12 ISPF Menu structure


56 | P a g e

THE PRIMARY ISPF MENU

The start-up screen on ISPF user interface is called the ISPF Primary Menu. The ISPF
primary menu is central screen that offers several different options.

Every ISPF menu has an action-bar. If you position your cursor on the action-bar and
press<enter>, a pull-down is displayed.

Fig 4.13 Primary ISPF Menu

The title of the panel ISPF Primary Option Menu is displayed at the center. The
Option ===> ____ is a data-entry field, where you may type something. It is the
command-line. You may enter any of the menu options 0, 1, 2, 3 …, 11 on the
command-line.

THE HOME AND TAB KEYS

While signing-up an Internet forum or a portal, you use the TAB key to jump to the next
field. On the same lines, on the ISPF user-interface the TAB key takes your cursor from
one field to the next.

The Shift + TAB key combination positions the cursor to the previous field.

The Home key of the standard keyboard resets the cursor position to first data-entry
field on the screen.
P a g e | 57

AID (ATTENTION IDENTIFIER) KEYS

AID (Attention Identifier) Keys is the standard IBM term for any key which literally
wakes up and alarms the TSO software on the mainframe to process your commands.

The TSO/ISPF environment is just a software program. For every active user logged
on to the mainframe system, there is a copy of the TSO/ISPF program running. When
the program is waiting on terminal I/O (the user is in between commands or thinking
what to do next), it is said to be in TERMWAIT state. In the TERMWAIT state, the
program is idle and is swapped out from primary to secondary memory.

When the user presses an AID key, it ends the terminal wait and the TSO software
program is swapped into primary memory. It is marked as USRRDY (Ready state).
Based on certain scheduling algorithms, the TSO software program is then assigned to
the CPU and processes your inputs.

PF (PROGRAM FUNCTION) KEYS

IBM refers to the function keys F1, F2, F3, …, F12 as program function keys abbreviated
as PF-keys. On the ISPF user-interface, each of these PF-keys performs a special
function.

The PF1 key is for HELP. The PF2 Key is used to split screens.

The PF3 key is used to cancel the current action and exit from an ISPF Menu. It takes
you back to the last screen you were on. For example, if you go to ISPF
Main Menu > 3 (Utilities) > 2 (Allocate) and press PF3 key, it leads you back to 3
(Utilities) panel. Pressing PF3 once again leads you to Main Menu.

On any ISPF screen, the PF7 key performs scroll up. The PF8 key scrolls down in the
dataset. The PF10 key performs left-scroll, whereas the PF11 key performs right-scroll.

LOGICAL SCREENS

ISPF allows you to open multiple logical screens. To start a new logical screen simply
type START <ispf menu option>. For example, I will start two ISPF logical screens. On
the first logical screen, I shall visit menu option 3.2 (Allocate). On the second logical
screen, I shall go to menu option 3.4 (Dataset List).
58 | P a g e

Fig 4.14 First Logical Screen

On the ISPF primary menu, I type =3.2 and press <enter>.

Fig 4.15 Data set Allocation panel on the first logical screen
P a g e | 59

To start the dataset list utility menu 3.4 on a new logical screen, type START 3.4 on the
command line and press <enter>.

Fig 4.16 START command is used to open a new logical screen

On pressing <enter> key, the dataset list utility menu 3.4 opens up on a new logical
screen. To see the list of all logical screens open, type the SWAP LIST command and
press <enter>. Take a look at figure 4.17.

On the Windows OS, you may switch from one window to another using windows
shortcuts such as Alt + Tab, in the ISPF user interface you may swap from one logical
screen to the another, forward or backwards by entering the command SWAP NEXT or
SWAP PREV respectively.

Theoretically, it is possible to have upto 32 logical screens, however most mainframe


sites allow you to have upto 8 logical screens. You may directly jump to any logical
screen by entering the screen-no and pressing the PF9 key. To view the first logical
screen, you type 1 and press PF9 key, to view the second, you type 2 and press PF9
key and so forth.
60 | P a g e

Fig 4.17 List of all the logical screens displayed using SWAP LIST command

ALLOCATING AND DELETING DATASETS

To allocate a new Dataset or delete an Existing Dataset, the Dataset Allocate/Delete


ISPF-Panel (3.2) is used. Enter the dataset-name in the format
XXXXXXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX separated by period and prefixed by
your TSO User-ID. Look at Figure 4.18, on how I have entered the file name for the
Monthly Sales Report.

Allocation of new datasets requires the user to specify the space requirement, how
much space in TRKS or CYL the Dataset should occupy. Look at the figure 4.19. The
file SYSADM.MONTHLY.SALES.REPORT will be 10 primary and 10 secondary tracks
large. On pressing enter, a message 'DATASET ALLOCATED' is displayed on the top
right hand corner of the screen as seen in figure 4.20.

Deleting a dataset is achieved by using the D (Delete) command. Search the dataset
using the DSLIST Menu(3.4) and typing D against the dataset name. Look at the figure
4.21.
P a g e | 61

Fig 4.18 Allocating a new dataset using ISPF Option 3.2

Fig 4.19 The monthly sales report dataset is 10 tracks large


62 | P a g e

Fig 4.20 Successful allocation of the dataset

Upon successful deletion, the message 'DATASET DELETED' is shown. Refer to the
figure 4.22 below.

Fig 4.21 Deleting a dataset


P a g e | 63

Fig 4.22 Successful deletion of a Dataset

MOVING AND COPYING DATASETS

The move/copy utility ISPF Menu 3.3 is used to create a copy of a dataset – it works
for both sequential and partitioned datasets.

To create a copy of the dataset SYSADM.MONTHLY.SALES.REPORT, navigate to


ISPF Menu 3.3. Enter the Option ===> C to copy a file along with the complete file-name
in the From Data set name field as shown in figure 4.23 and press enter. The From field
indicates the source of the content. On the following screen, the To field shall indicate
the target file to which the content shall be copied.

Fig 4.23 Copying a dataset using ISPF Menu 3.3


64 | P a g e

Fig 4.24 Entering the “To” dataset where you would like the data to be copied

I would like to copy the contents from the file SYSADM.MONTHLY.SALES.REPORT to


SYSADM.MONTHLY.SALES.REPORT.BACKUP. Enter
SYSADM.MONTHLY.SALES.REPORT.BACKUP in the To field. Take a look at the
figure 4.24. Under the “To” dataset options, the disposition of the dataset is Mod. This
implies that if the “To” dataset does not exist, it will be automatically created and the
contents will be copied to it. On the other hand, if the “To” dataset exists on the
mainframe system, these contents will get appended to the data already present in the
file.

Upon successful copy of the dataset, a message 'Data set copied' is displayed in the top
right hand corner of the screen. Refer to figure 4.25 below.

Using the ISPF Menu 3.3, it is also possible to create a copy of PDS (Partitioned
datasets). When you copy a partitioned dataset, all the members from the source PDS
will be copied to the target PDS. You may also copy selected members of one PDS to
another.
P a g e | 65

Fig 4.25 Data set copied successfully

On the mainframe system I am connected to, I have stored all the source programs
written in Cobol in a library SYSADM.DEMO.SRCLIB. I would like backup my library to
another PDS SYSADM.DEMO.SRCLIB.BACKUP. To copy all members of a PDS, use
the wildcard *. For example, to copy all members of the partitioned dataset
SYSADM.DEMO.SRCLIB, enter 'SYSADM.DEMO.SRCLIB(*)'. Refer to figure 4.26.

It is also possible to copy only select members from one PDS to another. While doing
so, do not enter the wild-card *. Instead just enter the “From” dataset name as
'SYSADM.DEMO.SRCLIB' and the “To” dataset name as
'SYSADM.DEMO.SRCLIB.BACKUP'. On pressing enter, another screen displayed that
asks you to choose the members you would like to copy. Select the members, that you
intend to copy by typing S (SELECT) against the member-name. Refer to figure 4.27
66 | P a g e

Fig 4.26 Copying all the members of a PDS

Fig 4.27 Copying select members of one PDS to another


P a g e | 67

A mask is a pattern to select the candidate member-names. For example, to copy all
member-names starting with the PROG4, use the mask PROG4*. Enter
'SYSADM.DEMO.SRCLIB(PROG4*)' to copy all members, whose name begins with
string PROG4. Take a look at figure 4.28.

Fig 4.28 Using a mask to copy all members whose name begins with PROG4.

Fig 4.29 List of members that match the pattern PROG4*.


68 | P a g e

Observe that the members PROG40, PROG41, ...,PROG49, all match the pattern
PROG4*. Choose the members to copied by typing the S (SELECT) Command against
them. To select all the members here, there’s a shortcut. You can do that in one shot by
typing the command S * on the command-line and pressing the return key. Refer to the
below figure 4.30 and 4.31.

Fig 4.30 Select all the members in one shot using S * command

Fig 4.31 Result of copying all the members using S (SELECT) * (ALL) command

Copying creates the replica of the member of the source dataset into a target dataset.
However, moving actually relocates and shifts the member(s) from the source dataset to
the target.
P a g e | 69

Select the option M - Move on the ISPF menu 3.3 Move/Copy utility, type the source
dataset name from where the members should be picked up and press <enter>. As in
the copy, entering a wild-card * moves all the members. Entering a mask causes ISPF
to move select members matching the pattern.

Fig 4.32 Moving the members from PDS to another

On the succeeding panel, type the name of the target dataset, to which the members
would be moved and press <enter>. All the members are moves from the source to the
target PDS.

MORE ON DATASET LIST UTILITY 3.4

The dataset list utility ISPF menu 3.4 is used to find the datasets stored on a disk or
tape device. We enter the enter the complete-name of the dataset or use the wild-card(*)
to specify a generic name and press <enter> to invoke the search. This is shown in
figure 4.33.
70 | P a g e

Fig 4.33 The dataset list utility to find the datasets on disk or tape

Fig 4.34 The results of the dataset search


P a g e | 71

The results of the search displays all datasets matching the pattern
SYSADM.DEMO.XXXXXXXX. You may want to perform a number of functions on the
dataset.

View a file – To open a file in view mode, type V against the dataset and press <enter>.
The view mode allows you to view the contents of the dataset, but you can’t modify
them.

Edit a file – To open a file in edit mode, type E against the dataset and press <enter>.
The edit mode allows you to both see and modify the contents of a dataset.

Browse a file – To open a file in browse mode, type B against the dataset and press
<enter>.

Open a PDS - To open a PDS and see the list of members, type M (Members) against
the dataset and press <enter>.

Information (characteristics) of a file – Information about the dataset such as the record-
length, the record format, whether the file is sequential or partitioned and a myriad of
other things are displayed, if you type I against the dataset and press <enter>. Look at
figure 4.35 below.

Fig 4.35 A plethora of information about the dataset


72 | P a g e

5
The ISPF Editor
ISPF TEXT EDITOR

The ISPF text editor is the free IBM software used to enter and store data in mainframe
files. The ISPF text editor is a power-packed word-processor with a plethora of
advanced features that save several key-strokes and time. Although there are other
commercial file-management products such as Compuware® File-Aid, the ISPF Text-
Editor is free, light-weight software.

ISPF text editor supports primary commands and line commands. Primary commands
are global, and affect the entire data-set such as FIND, CHANGE, SAVE, REPL, UNDO
etc. You enter primary commands on the command-line. Line commands apply to a
single line or a block of lines. Line commands are entered in line-field, shown in red in
the figure 5.1.

Fig 5.1 Primary commands and Line commands

To move your cursor from one field to the next, you use the <TAB> key. To reset the
cursor position to the command line, use the <HOME> key. This
P a g e | 73

INSERTING LINES AND ENTERING DATA

To begin entering data, <TAB> down your cursor to any of the line fields and type In
where n is an integer number and press <enter>. For example, I have type I5 on the line
field of the '***TOP OF DATA***' line.

Fig 5.2 Inserting five new lines

Five new lines shall be inserted after the current line. The results are shown in figure
5.3.

Fig 5.3 Five new lines are inserted

While entering a JCL or a COBOL program, you wouldn’t know how many new lines of
text would need to be inserted before-hand. You would like to keep inserting new lines
of text as you type. Just type I without any number on the line field to insert a new line.
Take a look at figure 5.4 and figure 5.5.
74 | P a g e

Fig 5.4 Inserting a new line of text by typing I (without a number) in the line field

Fig 5.5 A new line of text is inserted

The ISPF text editor goes in the insert-mode. After entering the complete data on this
line, if you press <enter>, a new line of text is automatically inserted and the cursor is
positioned on the new line.

Fig 5.6 The editor is in insert mode

If you press <enter> twice (a null line), the editor goes out of the insert mode and any
empty lines on which data wasn’t entered shall go away.

DELETING LINES

To delete lines, position your cursor to any line field and type Dn where n is an integer
number. For example to delete 3 lines, type D3. To delete only one line, just type D
without any number.
P a g e | 75

Fig 5.7 Deleting lines by typing D3

Fig 5.8 Results after the deletion

REPEATING LINES

Enter Rn to repeat a line n times. Enter R to replicate the line only one time. Look at the
figure 5.9 and 5.10.
76 | P a g e

Fig 5.9 Repeating a line two lines

Fig 5.10 The results of replication

MOVING AND COPYING LINES

To move (shift) a line type M in the line-field. To copy (duplicate) a line type C in the line
field. You may move/copy a line X to before or after another line Y. Take a look at
figures 5.11 – 5.14.

Type B on any line field to place the moved/copied line before it. Type A on any line field
to place the moved/copied line after it.

To move n lines, you can type Mn on any line field. To copy n lines, you may type Cn on
any line field.
P a g e | 77

Fig 5.11 Move line 1500 after line 1600

Fig 5.12 Results of move after

BLOCK EDITING

Just as you perform line operations like move, copy, replicate and delete, you may also
perform block-editing. A block is a group of lines. You can move or copy an entire block.
You can replicate a block. You may delete a block of lines too.

To move a block of lines, enter MM on the first line and the last line of the block.
To copy a block of lines, enter CC on the first line and the last line of the block.
To replicate a block of lines, enter RR on the first line and the last line of the block.
78 | P a g e

Fig 5.13 Move line 1500 before line 1600

Fig 5.14 Results of Move Before

To delete a block of lines, enter DD on the first line and the last line of the block.

FINDING AND CHANGING DATA

The FIND primary command searches a text-string in the file. You can specify a text-
string enclosed in single-quotes/double quotes following the FIND command. For
example to search the word 'DISPLAY' in the file, I’ll type FIND 'DISPLAY'.
P a g e | 79

Fig 5.15 FIND command to search for a string

On pressing <enter>, all strings matching the word 'DISPLAY' are highlighted in the file.
The cursor is automatically positioned at the first matching result. Look at figure 5.16. To
see the next matching result in the file press <PF5> key.

There are two basic variations of the FIND command. You may use the keywords ALL
and PREV with the FIND command. Assume that a file contains 1000 records and you
are at record-500.

The FIND PREV '<text-string>' starts searching the file from the current position
(record-500) upto the beginning (record 1) of the file in the reverse direction.

The basic FIND '<text-string>' command searches from the current position (record-
500) till the end (record-1000) of the file.

The FIND ALL '<text-string>' resets the cursor position and starts the search from the
beginning (record-1) of the file and continues upto the end (record-1000). In other
words, it searches the entire file ALL over again.
80 | P a g e

Fig 5.16 Result of the FIND primary command

The CHANGE command is used to search a text-string str1 and if a positive match is
found, replace it with another string str2. To replace strings, type C 'str1' 'str2'. You can
use the keyword ALL and PREV with the CHANGE command too. While the basic
CHANGE command replaces only one string, the CHANGE ALL version of it, replaces
all instances of str1 with str2.

SAVING YOUR WORK AND EXITING

Enter SAVE primary command to commit all the changes made to file. You may enter
CAN to cancel and revert back any changes made to the file. To exit the ISPF text-
editor, type EXIT or press the <PF3> key.
P a g e | 81

6
The structure of
Job Control Language (JCL)
BATCH PROCESSING VERSUS ONLINE PROCESSING

The origin of the term batch processing dates back to the era of mainframe computers
such as IBM 701. Typically, when a huge volume of input data is processed in bulk, the
input data are stored in a batch of files, and are then processed by software in batches.

Jobs are set up to complete without any manual intervention. The operator specifies (i)
The program to run(ii) the input files and (iii) the output files for storing the results. The
computer program shall take the set of input files, process the data, and produce a set of
output files. The operator submits (SUB) the job for execution. Depending upon the
demand on the computer, the job may take a while to complete. On completion, the job
alerts and notifies the operator.

Batch-oriented applications are offline systems. You do not get immediate outputs to
the inputs you supply. During execution, there is no interaction between the program and
the users.

Batch applications are still critical in many core businesses like banking, insurance,
telecom. For example, telephone billing has to be done at the month-end, tallying the
bank accounts balance, interest calculation, printing statements has to be done at the
end-of-day. These are high-volume, repetitive tasks which must be completed reliably
on-time. They do not require human interaction.

The opposite of batch processing is interactive processing. The user types input on
the screen, the program processes the input right-away and displays the output, the user
types some more input, the program processes it and you get some more output. The
input-Process-output cycle of events continue, until the final solution. The program gives
82 | P a g e

an immediate (quick) response or output to the inputs you supply, on the fly. Such
interactive applications are online systems.

A transaction is the basic unit-of-work in online systems. A transaction runs one or


more programs to process the data. A user types the input data on the computer screen,
and presses Enter to start the transaction. The transaction invokes one or more
programs to process the data right away. Immediately, the output results are displayed
on the terminal and the transaction ends.

WHAT IS JCL (JOB CONTROL LANGUAGE)

On a desktop PC you double click on the icon of the software application to run it. On a
mainframe computer, you setup a job and submit it to the OS, to run a program.

Job Control Language (JCL) is the language used to write a job. It instructs the
mainframe computer which program to run, what the input files are and the output
files to store the results.

LOAD MODULE AND LOAD LIBRARIES

A program is a sequence of instructions to the computer to accomplish a task/function.


A program is usually written in a pseudo-language like Assembler, COBOL, PL/I, C,
C++, Java etc. Your program statements are then translated into binary machine
language which the mainframe computer can interpret. These machine language
programs are stored as members in partitioned datasets. The partitioned dataset (PDS)
containing machine language code is called load library and the binary programs are
called load modules.

To execute a program, you must specify the load module and load library in the JCL.

YOUR OWN PROGRAMS VERSUS IBM UTILITIES

Building your own software programs is cool. You may write your own custom COBOL
Programs to perform a task. But, if there is a solution or product already available to
accomplish the same task, you may consider using it. Why re-invent the wheel?

A lot of free goodies are shipped along with a new mainframe computer. This includes
programs you may directly lift and use in order to perform certain basic and common
tasks. To create a copy of a file, sorting the contents of a file could be done using these
ready-made programs. Such ready-made, free software programs shipped along with
mainframe computers are called utility programs.

An example of such a utility program is IEBGENER. IEBGENER is used to copy the


P a g e | 83

contents of one file to another. It essentially creates a shadow copy of a file.

HOW COBOL PROGRAMS REFER TO FILES

All COBOL programs (whether your own program, or a free utility) refer to the input and
output files that they access, not by the actual (physical) file name, but rather through a
short symbolic name. It is through the JCL, you must assign the real physical file-
name to the symbolic name.

The IBM Utility program – IEBGENER expects 4 files:

Symbolic name Description


SYSUT1 Source file from which IEBGENER would read the data
SYSUT2 Target file to which IEBGENER would write the data
SYSIN Optional instructions file where IEBGENER expects to receive any
special instructions.
SYSPRINT Log file to which IEBGENER writes a simple report about the details
of its work, whether the copy process was successful or it failed
amongst other things.

Thus, IEBGENER reads input from //SYSUT1 file and copies it to //SYSUT2 file. It is a
simple copy utility.

Fig 6.1 The input and output files for IEBGENER utility program

When you setup a job to run IEBGENER utility, you must assign real physical dataset
names such as SYSADM.INPUT.DATA to the symbolic file names like //SYSUT1,
//SYSUT2, //SYSIN and //SYSPRINT. Thus, JCL specifies the input and output
datasets and hooks them up to the Cobol program.
84 | P a g e

DIFFERENT STATEMENT TYPES IN JCL

JCL is very simple and easy to master. There are only eight different JCL statement
Types. JCL is actually a piece of cake because you use only three of these JCL
statements most often – JOB, EXEC and DD.

You’ll use these very often!

//name JOB parameters ...


//name EXEC parameters ...
//name DD parameters ...

You’ll use these to gift-wrap and pack your JCL code into PROCs for distribution or
circulation.

//name PROC parameters ...


//name PEND parameters ...

These are [optional].

//* Comment
/* Delimiter
// Null ending statement

I shall focus mostly on the 3 important statement types – JOB, EXEC and DD, so you
can start building your own jobs and become JCL savvy. A discussion on how to pack
JCLs into procedures using PROC and PEND is beyond the scope of this book.

HOW DOES A JCL LOOK

I am going to employ JOB, EXEC and DD statements to setup a job that copies a file
using IEBGENER Program. Find below a stripped down generic version of the job.

General format:

//SYSADMA JOB parameters…


//STEP01 EXEC parameters…
//SYSUT1 DD parameters…
//SYSUT2 DD parameters…
//SYSPRINT DD parameters…
//SYSIN DD parameters…
//
P a g e | 85

I hope you recognize this pattern – JOB, EXEC followed by one or more DD statements.
The JCL for all your batch jobs will start with one JOB Statement. Following this, the
EXEC statement tells which program to run. And then you code one or more DD (Data
Device) statements for specifying the input and output files used by the program. The
DD statement would assign the symbolic name to an actual dataset name.

Below is the JCL that executes the IEBGENER program to copy the contents of the
physical sequential (PS) file SYSADM.INPUT.DATA to SYSADM.OUTPUT.DATA.

Fig 6.2 Writing a JCL to run IEBGENER utility for copying files

The data in the //SYSUT1 input file SYSADM.INPUT.DATA is as follows,

Fig 6.3 The SYSADM.INPUT.DATA file containing input data

As an exercise, create a new member COPYPS under your JCL library, type the JCL
listing above in figure 6.2 and SAVE the file. Replace the words SYSADM in the JCL by
your own TSO user-id. The procedure to submit a job for execution and thereby run the
program shall be discussed at length, further ahead in the book.
86 | P a g e

7
The basic frame-work of JCL
I presume that you have pretty fair idea about what JCL is, why it’s used and what it
looks like. All JCL you are going to build would be composed of three main statements:

Label Operator Parameters


// name JOB Parameters
// name EXEC Parameters
// name DD parameters

LABELS

Every JCL statement has a label – a symbolic name assigned to them. It’s like naming
kids. Well, there could be so many kids in your block, but how does one know them? Of
course by their names!

Likewise, a JCL may contain a bunch of statements, one for the job-level details, another
that tells the program to be run, one for input file, one for the output file, one for the error
file. How do you tell them apart? You must therefore name them. As a good practice, we
always assign names to all our JCL statements. Well, names help you to refer back to
these statements in the future. You want to talk about a particular JCL statement with
your friend, just spell out its name.

THE TWO SLASHES //

Notice carefully that each label (name) is preceded with two slashes //. The two slashes
are a JCL statement’s signature. They indicate that the statement is a JCL statement
(one of JOB, EXEC, DD). Every JCL statement wear the two slashes //. A naked
statement without // won’t be treated as a JCL Statement.
P a g e | 87

PARAMETERS

Every JCL statement - JOB, EXEC and DD carry lots of parameters with them. JOB,
EXEC and DD statements form the skeleton of the JCL. Parameters add flesh and blood
to it.

OPERATORS IN A JCL

Operators are the basic elements of any JCL. Every JCL is made up of mainly JOB,
EXEC and DD statements.
 JOB is easy to learn and use.
 EXEC is easy and fun to use.
 DD Statements take three forms:
1. DD Statements to read a file. (easy)
2. DD Statements to write output to the spool. (easy)
3. DD Statements to create a new file (hard!); you’d have to learn
parameters such as DISP, UNIT, DCB, SPACE and several others to
code this.

Have a good look at this chart:

Fig 7.1 The operators of a JCL

JOB STATEMENT

You code the JOB statement at the start of any JCL you write. It assigns a unique job-
name enabling the zOS operating system to identify the job. The JOB statement
declares the name of the programmer as well. It indicates the destination where the logs
should be sent – a commercial printer or a queue. how much reporting (level of detail)
88 | P a g e

should zOS provide and how important the job is as compared to other competing jobs.

You can even indicate things like memory and processing time limits on the JOB
statement.

You write the JOB statement starting with a name, which is called the JOB name. The
JOB name identifies the job to the zOS. The zOS keeps track of thousands of Jobs
using job names.

The most general form of the JOB Statement is this :

//SYSADMA JOB other parameters…

The job-name that follows the slashes is usually your TSO user-id followed by a single
letter. Like my TSO user-id happens to be SYSADM, so I’ve coded the job-name as
SYSADMA. By doing so, anyone who happens to look at these jobs will deduce that all
jobs that start with SYSADM* belong to (are owned by) the TSO User-id SYSADM. It
becomes much each easier to trace/revert back to the owner. God forbidding, should
your job fail for some reason, looking at the job name the operator immediately knows
the individual responsible and contacts him.

The contents of your JOB statement usually remain the same. When assigned to a new
software project, you create a JOB statement once and then you use the same JOB
card for most of your work.

Back in 1950s, programmers were charged for computer-time they used on a


mainframe system for their work-loads. They had to put their account number on the
JOB card. Some installations still assign an account number to every TSO user. In this
example, I have used a dummy account number A123.

You would use other parameters too like CLASS, MSGCLASS, MSGLEVEL, NOTIFY,
REGION, TIME and PRTY in your JOB Statements. These are discussed further ahead
at length.

In the figure below, I’ve reproduced the JCL, I wrote to copy one file to another using
IEBGENER Utility program. Notice, the two different styles of coding the parameters.
You can code just one parameter on each line to make it more readable.
P a g e | 89

Fig 7.2 Coding parameters separately on each line

There are two different coding styles –

(a) You can code JCL with a compact JOB Statement and put several parameters on
the same line
(b) An easier to read-style, is to code one parameter on each line, leaving room for
comments.

EXEC STATEMENT

The EXEC Statement is the engine of your JOB. The EXEC statement tells the zOS
which program to run. You use the EXEC statement to announce to the zOS which
program, you want to run.

//STEP01 EXEC PGM=IEBGENER

Like any other JCL Statement, you write the EXEC statement starting with two slashes
//. You assign a name/label to the EXEC Statement, for unique identification like
//STEP01, which is called step name.
90 | P a g e

Here are a few important points worth noting about the EXEC statement –

1. The step name is just a name given to the EXEC statement. The step-name
could be omitted as well. However, it’s always good to name all your EXEC
steps, so that you can always refer back to step later. This would count a lot,
pretty important stuff, when you write multi-step jobs.

2. As Shakespeare has said, what’s in a name? A step-name is just a name given


to the EXEC Step. The name could be possibly anything at all, it doesn’t need to
always start with //STEP prefix. You could also name your step as //QUASAR or
//BARABARA or //COPYSTEP or any name of your choice. But most people
would use a step-name which is meaningful, and conveys the meaning of the
step.

3. The executable program that you want to run should be specified after PGM.

You can code a lot of extra things on the EXEC Statement, such as REGION, TIME,
COND, PARM and ACCT.

Fig 7.3 Coding the REGION and TIME parameter on the EXEC statement

In the above JCL, I’ve coded REGION and TIME parameters on the EXEC statement.
REGION and TIME specify an upper bound on the memory and time, the program is
P a g e | 91

allowed to utilize. For example, IEBGENER can use memory upto 2048 Kb and is
allowed to run for a maximum time of 1 minute 30 seconds.

DD STATEMENT

A program executed at a step can access zero, one or more files (datasets). For each
dataset, the program accesses, you must code one DD statement. Every DD statement
has a label (name) called the DD-name.

zOS frees and relieves the programmer/developer from having to know the actual (real)
physical file name and other details about the files at the time of building the program.
The programmer is unaware of the physical dataset name such as
SYSADM.INPUT.DATA. Instead in COBOL, he refers to the input file(s) and output
file(s) only by a pet-name internal to the COBOL program. COBOL programs refer to
files by a COBOL file-name internally known.

A DD-name establishes the link between the physical dataset name and the internal
COBOL file-name. DD-names serve as an indirect reference to the actual file. The
diagram in fig 7.4 below, illustrates how symbolic DD-names are associated with real
physical files.

The COBOL program MYCOPY refers to the files by pet-names INPUT-FILE and
OUTPUT-FILE only visible internally within the program. In the JCL, you specify the
actual (real) physical files in the DD statement, SYSADM.INPUT.DATA and
SYSADM.OUTPUT.DATA. The bridge that connects the two is the DD-name INPUTDD
and OUTDD. This helps establish a relationship.

The COBOL program and the JCL; there should be common agreement amongst them,
with regards to the DD-names. If the COBOL program expects an input file by the DD-
name //INPUTDD and you do not supply it in the JCL, the JCL would error out.

The same principle applies to the IBM-supplied utility software such as IEBGENER,
SORT, IEBCOPY, IDCAMS etc. The developers of IEBGENER assumed a DD-name
for the input file as SYSUT1 and output file as SYSUT2. Thus, you must supply physical
dataset names for //SYSUT1 and //SYSUT2 files in your JCL by coding appropriate DD-
statements. //SYSUT1 DD and //SYSUT2 DD statements must be present in your JCL.
For utility programs, the DD-names are decided by IBM and you have to stick to them.
92 | P a g e

Fig 7.4 Relation between symbolic DD-Name and real physical file-names

DIFFERENT TYPES OF DD STATEMENTS

There are three general categories of DD statements:

1. A DD statement for reading a file/dataset.


2. A DD Statement for writing to the spool (output queue). When a job runs on the
mainframe computer, zOS operating system generates a number of messages
describing how each job ran, whether it completed successful or it failed. This is like the
log of a job. The spool is an area, where job-logs are stored. With this DD statement,
you can write any output to the spool.
3. A DD statement for creating a new dataset, and writing to the file(dataset).

Here is a concrete example to explain the same.


P a g e | 93

Fig 7.5 Three different types of DD statements

Reading a file or dataset


The IEBGENER program expects to read the records from an Input file at the //SYSUT1
DD statement. There’s nothing much to it. On line 11, I have coded the DD statement
for reading records from an input file.

Creating a new dataset and writing records to it (hard!!)


The IEBGENER program would write the records to the output file at the //SYSUT2 DD
Statement. I would like to copy the data from an old input file to a new output file
SYSADM.EMPLOYEE.MASTER.FILE. Since the employee master file doesn’t already
exist and it needs to be created newly, I have used a different DD statement on lines 12
- 15. To create a new file/dataset in JCL, observe that you need to code a lot of
parameters like SPACE, UNIT, DCB etc.

Writing to the spool


The IEBGENER program writes messages about its successful completion and the
number of records copied to //SYSPRINT. I would like to direct these messages to the
spool (output queue), so I code SYSOUT=* on the //SYSPRINT DD statement.
94 | P a g e

Fig 7.6 The different DD statements in the JCL


P a g e | 95

8
Multi – step Job streams
JOB TRAIN

Can a job run just one program? What if I want the output of one program, to be fed as
input to a second program? The answer to this question is, “Yes, a job can have many
(multiple) steps, where each step runs a program”. The output of 1st step can be fed to
the 2nd step, the output of 2nd step can be fed to the 3rd step and so forth.

You are familiar with the general pattern of any Job. It has a JOB statement at the
beginning that describes the job, EXEC to run the program, followed by one or more DD
statements that represent the files/datasets from which the program accesses data. It
looks like this –

//name JOB parameters


//name EXEC parameters
//name DD parameters..
//name DD parameters..
//name DD parameters..

This is a very simple, single-step job. However, most production jobs of an IT system
have multiple steps. Each step runs a program that reads input data, processes it and
writes some output. Thus, typically the job would be a stream, an inter-linked chain of
several steps.

A multi-step job-stream is like a railway train with a locomotive pulling several carriages.
The JOB statement is the locomotive engine. Each program to be run is a train
compartment and the last bogie/compartment would be null card – indicating the end of
the job train.
96 | P a g e

Fig 8.1 Job Train

In this job train, each step runs a program, that receives input feed from the preceding
step (step before that), processes it and gives an output, which is fed to the next
successive step. In this fashion, the data is processed step-by-step until you arrive at
the final output, once the last step is complete.

DESIGNING A TOY JOB

In order to acquaint your-self with multi-step jobs, I suggest, you take a look at some of
the production jobs at your mainframe shop, analyse them and see how they work. This
would give you a far better picture of how multi-step jobs work.

We shall design a three-step toy job to aid our understanding. It is advisable to draw a
flow-chart first, before proceeding to write the JCL statements.

Requirement
An organization has several employees. The list of employees is stored in a mainframe
file EMPLOYEE.FILE. The organization requires a report of all employees listed in order
of their employee identification number. We must design a JCL that shall (i) Print the
contents of the EMPLOYEE.FILE for information recording purposes (ii) Sorts the data of
the EMPLOYEE.FILE by the employee identification number. (iii) Copy the sorted listing
to a report. A rough skeleton of the three-step toy-job is shown below.

//SYSADMA JOB
//STEP010 EXEC PGM=IEBGENER
//SYSUT1 DD
//SYSUT2 DD
//SYSIN DD
//SYSPRINT DD
//STEP020 EXEC PGM=SORT
//SORTIN DD
//SORTOUT DD
//SYSIN DD
//SYSOUT DD
//STEP030 EXEC PGM=IEBGENER
//SYSUT1 DD
//SYSUT2 DD
P a g e | 97

//SYSIN DD
//SYSPRINT DD
If you can graphically draw what a JCL would do (does), it helps a lot to understand the
JCL. In each step, we would read one/more datasets, do some processing, and produce
reports and write output to one/more datasets. First let me draw a simple diagram for the
above JCL skeleton.

Fig 8.2 Basic flow diagram for the toy JCL

Enrich this basic diagram by adding some more flowchart symbols, as shown in the
figure 8.3 below.

Fig 8.3 Basic flow chart symbols

There are other flowcharting symbols such as decision-box and loop statements. Bear
in mind, however, that JCL is not a programming language. So, we don’t use these
other flow-chart symbols.
98 | P a g e

A CRASH COURSE ON DD * AND DD DUMMY STATEMENTS

The DD * and DD DUMMY statements have special meaning in JCL. Before constructing
the toy job, get here's a crash course.

You may want to issue special instructions (commands) to IEBGENER. Like "Copy only
those employee records whose name starts with A". This isn’t input data rather these are
commands or instructions (orders) to IEBGENER. It instructs IEBGENER to copy a
subset of the records. Such instructions to the program being executed that exert
influence and control how the program functions are called control instructions.

1. DD * - Control instructions are different from data. Data is passed to the program in
a file. With control instructions, the custom adopted is to hard-code and imbed them in
the body of the JCL itself, instead of putting them in a separate dataset.

Whenever you want to directly hard-code data and/or instructions in the JCL, you must
use * (asterisk) as a parameter on the DD Statement.

//name DD *
control instruction 1 -
control instruction 2 -
...
/*

At the end of the control instructions, you put a delimiter statement /*.

2. DD DUMMY – Sometimes, you may want to turn off or shut down the input/output to
a program. As an example, suppose you don’t want to supply any control instructions to
IEBGENER. Turning off the input or output isn’t easy, because IEBGENER expects you
to code //SYSIN DD Statement. Omitting //SYSIN DD isn’t an option (that would be a
JCL error). You can’t do away with it, just like that. So, you code a DUMMY parameter
on the //SYSUT1 DD Statement. DUMMY implies that it is just a DUMMY input or output
file. In other words, that input/output feed is turned off (you have just sealed it off!).

DD * and DD DUMMY come in handy while giving control instructions, giving test data to
your programs as input.

PUTTING IT TOGETHER PIECE BY PIECE

The journey begins! We shall first construct (pieces) blocks one-by-one and then put
them all together, assemble them to build a complete job.
P a g e | 99

The toy job shown here does the following:

1. STEP010 – Read the EMPLOYEE data stored on a disk file


SYSADM.EMPLOYEE.FILE and print a list of all employees to the spool for
information recording purposes.

2. STEP020 - Arrange the records of the EMPLOYEE Data file in order of the
employee identification numbers i.e. sort the EMPLOYEEs data.

3. STEP030 – Print a report of the sorted output EMPLOYEE Data to the spool.

The first //STEP010 of the toy job, runs IEBGENER. IEBGENER requires the following
files:
a) IEBGENER expects to read the input file at //SYSUT1 DD Statement.

b) IEBGENER copies the contents and writes it to the dataset represented by


//SYSUT2 DD Statement. We would like the input file’s contents to displayed in
the spool for record-keeping purposes, so it helps tracking. //SYSUT2 file must
point to the spool (code the parameter SYSOUT=*).

c) IEBGENER reads control instructions from the //SYSIN file. We are not going to
issue any control instructions and want this functionality turned-off. To seal it off,
we shall code a DUMMY parameter on the //SYSIN DD Statement.

d) IEBGENER writes messages about its execution – details of how many records
were copied to the //SYSPRINT dataset. We would love to have these messages
on the spool along with the job log. Hence, we shall code SYSOUT=* as a
parameter on the //SYSPRINT DD card.

With that background, let’s write JCL for the first step STEP010. The JCL listing is
shown below.

----+----1----+----2----+----3----+----4----+----5----+----6--
//SYSADMA JOB A123,'BIN-7 QUASAR',CLASS=A,MSGCLASS=Y,
// NOTIFY=&SYSUID
//STEP010 EXEC PGM=IEBGENER
//SYSUT1 DD DSN=SYSADM.EMPLOYEE.DATA,DISP=SHR
//SYSUT2 DD SYSOUT=*
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
100 | P a g e

The second step //STEP020 of the toy job runs the utility program – SORT. Essentially,
the SORT utility takes the records from the input file and arranges them in order (in
sequence) ascending or descending.

----+----1----+----2----+----3----+----4----+----5----+----6--
//STEP020 EXEC PGM=SORT
//SORTIN DD DSN=SYSADM.EMPLOYEE.DATA,DISP=SHR
//SYSUT2 DD DSN=&&OUTPUT,
// DISP=(NEW,PASS,DELETE),
// SPACE=(TRK,(10,10),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)
// UNIT=SYSDA
//SYSIN DD *
SORT FIELDS=(1,4,CH,A)
/*
//SYSOUT DD SYSOUT=*

Just like IEBGENER, the utility program SORT requires the following files:

1. SORT reads the raw data from the //SORTIN file. The //SORTIN DD statement
points to the mainframe input file SYSADM.EMPLOYEE.DATA. The picture of
the data in the EMPLOYEE data file is shown below. You too can set up the
records in your file in the same manner.

Fig 8.4 Input Data for the SYSADM.EMPLOYEE.DATA File

2. SORT utility arranges the input records in this file in accordance with the control
instructions that are supplied in the //SYSIN file. The employee identification
number is a 4-digit number that starts at position 1. I have supplied control
instructions to sort the data on the employee-id field starting from columns 1 and
length 04 bytes. The data would be treated as a textual string (characters) and it
should be sorted in ascending order (A). The control instruction for SORT utility
P a g e | 101

is:

SORT FIELDS=(1,4,CH,A)

3. SORT utility writes the sorted (ordered) results to the output file represented by
the //SORTOUT DD card. Here, I would like to create a new file to store the
ordered list of employees. This is one of the most difficult categories of the DD
statements to code.

I have not specified an actual output dataset name on the //SYSOUT DD card.
The &&OUTPUT file on the SYSOUT DD statement is a temporary file.
Temporary files get deleted after the job completes.

4. The SORT utility generates messages that describe how many records where
sorted. It sends them to the //SYSOUT file. It would be nice to have these
messages in the spool. Hence, I have coded SYSOUT=* on the //SYSOUT DD
statement.

The third step //STEP030 of the toy job runs IEBGENER for a second time in a row. I
have built the JCL for the //STEP030 as follows:

----+----1----+----2----+----3----+----4----+----5----+----6--
//STEP030 EXEC PGM=IEBGENER
//SYSUT1 DD DSN=&&OUTPUT,DISP=(OLD,DELETE)
//SYSUT2 DD SYSOUT=*
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*

1. IEBGENER reads the input from the //SYSUT1 file – this points temporary output
file &&OUTPUT containing the sorted output records from the preceding step
//STEP020. Thus, the temporary output file of the previous step is picked up as
input for the next step.

2. IEBGENER copies the sorted records from //SYSUT1 to //SYSUT2 file. The
//SYSUT2 DD statement points to the spool – SYSOUT=*. Thus, the ordered
listing of employees is written to the spool.

3. There are no control instructions to IEBGENER. I have turned off the //SYSIN DD
functionality by coding DUMMY Parameter on it.
102 | P a g e

Fig 8.5 Flow of the 3-step Toy job

4. IEBGENER message are written to //SYSPRINT DD file. I have set the


//SYSPRINT DD statement to point to the spool by coding a SYSOUT=*
parameter.
P a g e | 103

In a nutshell, our three-step job-stream does the following.


 It picks up unsorted,un-arranged input records from the file
SYSADM.EMPLOYEE.DATA.
 It sorts, arranges the data in ascending order, on the key field from
cols 1-4.
 It writes the sorted, ordered output records to the spool.
104 | P a g e

9
Submitting a job for execution
SUBMITTING A JOB FOR EXECUTION

On a mainframe computer, when you want to run a batch program, you setup a job and
issue it to the mainframe computer for execution. This is called submitting a job.

Contrary to what you might fancy, your job doesn’t run immediately. Mainframe
computers have huge workloads. Every application would like to get their work done
quickly.

A software called the zOS Workload Manager (WLM) manages the work on a
mainframe computer. It slices the CPU time amongst the jobs entered. System
administrators can classify the work into distinct service classes and define goals for
them. The WLM ensures that these goal definitions are met.

Before you are about to submit a job on the mainframe computer, give your JCL a
cursory-glance to ensure it is syntactically-correct. Forgetting to put a comma or
inserting unnecessary extra whitespaces can lead to JCL errors.

Be cautious about the datasets being used by the job. For example, make sure you've
already created the input dataset SYSADM.EMPLOYEE.DATA. To submit a JCL on the
mainframe, you must type the SUBMIT command or just SUB on the command-line. I
have shown below in the figure 9.1, how one submits a job on the mainframe.

When you press <enter>, the job SYSADMB is submitted to the mainframe computer for
execution. This is indicated by a IKJ56250I JOB SYSADMB(JOB00044) SUBMITTED
message displayed at the bottom of the screen. Look at figure 9.2. It implies that the job
SYSADMB has been submitted.
P a g e | 105

Fig. 9.1 Submitting a JCL on the mainframe computer for execution

Fig 9.2 The message indicating job has been submitted


106 | P a g e

Every job is assigned a job-id. You can see it in the message displayed on the screen.
The job-id assigned to my job is JOB00044.

A *** is also displayed that prompts TSO user acknowledge the message. You
acknowledge it pressing an AID key. As soon as you press <enter> key again, the
message goes away.

It is nice to code the NOTIFY parameter on the JOB statement of your JCL. Coding this
parameter gives you an alert, a notification message, when the job completes, saying
"The job SYSADMB has completed". Take a look at figure 9.3.

Fig 9.3 Notification showing that the job has completed successfully

HOW TO SEE THE JOB LOG IN TSO/ISPF

I submitted the simple 3-step JCL by typing the SUBMIT command. Shortly after zOS
also alerted me that my job SYSADMB has ended.

But, I don’t know for sure, whether my job completed successfully, or it failed (and the
reason why it failed). The zOS operating system keeps generating messages as a job
progresses. These run-time messages are kept in a log for record-keeping purposes. It
helps track if the job completed successfully or it failed. Further, the log also contains
error-messages that point out why the job fails.

The log of a job is stored in special dataset called the Spool. What really is the spool?
Historically, when jobs ran on a mainframe computer, their job logs had to be sent to a
printer. The log of batch job can run into hundreds of pages. Moreover on a mainframe
computer, many jobs complete in a matter of seconds.

However, output devices like the printer are not as fast and cannot match up to the
speed of processing of a mainframe computer. Hence, the pages of the job-log were
held in queue and then printed one-by-one. This staging area (queue) was called the
spool.
P a g e | 107

Before TSO and another software program SDSF was invented, you couldn’t see the
pages of the job-log till the time, it got printed. It would take days before you’d receive
the complete output for your job. Now-a-days, TSO makes this easy, it’s possible to view
the job logs in the spool (queue).

To see the job logs in the spool, a software application called SDSF is used. SDSF
stands for Spool Display and Search Facility – its a software program for displaying
the logs held in the spool.

To view a job log in the spool (Queue), type START SDSF on any ISPF menu and press
<enter>. The SDSF application starts. To see the job logs, you must type ST on the
SDSF menu and press <enter>. Take a look at figure 9.4.

Fig 9.4 View job logs in SDSF

A list of all job logs in spool (output queue) is displayed. By default, this list will display
only those jobs submitted through your TSO User-id. For example, if my TSO User-id is
SYSADM, it will display all jobs starting with (prefix) SYSADM*.

For each job that you submit, you find an entry in the spool. It also shows various details
like the job-name, owner, class and priority.

To view the contents any particular job log, you can type a question mark ? against the
job-name and press <enter>. This takes you inside the log. For example, I have entered
? against my job SYSADMB and pressed <enter>.
108 | P a g e

Fig 9.5 Browsing the job-log of the job SYSADMB

The job-log contains several sections or listings. You can type the command S (Show)
against each section (listing) to view its contents.

Fig 9.6 The S (Show) command to view a listing

INPUT QUEUE AND OUTPUT QUEUE

The input queue and output queue are analogous to the run-ways on an Airport. The
input queue is runway from where the jobs take-off. After their flight is complete, the
jobs land in an area called the output Queue.

When you submit a job for execution to the mainframe computer, it enters the input
queue. The JES (Job Entry Sub-System) is a software application that manages the
Input Queue and Output Queue. JES welcomes all jobs that enter the input queue
reads the JCL, converts it into an internal format known to the zOS. It performs any
necessary dataset allocations. In brief, it does preparations before the job can finally
execute.
P a g e | 109

The JES message log would contain messages, as shown in the below snapshot in
figure 9.7.

Fig 9.7 The JESMSGLG containing JES2 messages

The Job Entry Subsystem (JES) reads the JCL Statements. My JCL had 24 lines of JCL
code, so JES reports this as 24 cards read.

In another section called JESJCL, the zOS prints all the JCL statements of your job for
reference. It numbers the JCL Statements that you submitted as part of the original job.
Look at the figure 9.8.

The JESYSMSG listing contains memory allocation and cleanup messages. ALLOC
tells you which devices and how much memory was allocated for the job-step. As you
know, one step runs one program. It also informs you about the CPU time required to
process a job-step. Every job-step leaves behind a trail, a four digit COND CODE
(condition code) in the range of 0000 to 4095. A COND CODE 0000 indicates that the
job completed successfully. The picture below in figure 9.9 shows how the JESYSMSG
listing looks.
110 | P a g e

Fig 9.8 JESJCL showing a numbered list of all the JCL statements submitted

Apart from this, you may redirect the outputs of a program to the spool by coding a
SYSOUT=* parameter on any DD statement. For the 3-step job-stream that I have
written, I have set the //SYSUT2 DD of statement IEBGENER to point to the spool. This
means that, the outputs of //STEP01 and //STEP03 shall be displayed in the spool.

The first step copies the contents of the non-arranged input file to //SYSUT2 dataset.
The SYSUT2 listing of IEBGENER in the spool is shown in figure 9.10.

The second step runs the program SORT. SORT arranges the records in the
EMPLOYEE.DATA file by the employee-id field which starts at column 1 and is 4 bytes
wide.

The third step runs the program IEBGENER and copies the contents of the temporary
file containing the sorted output records to //SYSUT2 file. This //SYSUT2 listing is shown
in figure 9.11.
P a g e | 111

Fig 9.9 JESYSMSG listing containing allocation and cleanup messages

Fig 9.10 Un-arranged input records

Fig 9.11 Sorted output records


112 | P a g e

Any JCL errors can be fixed by looking at the messages in JESYSMSG listing of the job
log.
P a g e | 113

10
Learn Mainframe programming
GOOD BOOKS TO SHARPEN YOUR SKILLS

On the mainframe, you build application programs in a high level language like COBOL.
The book titled COBOL for the 21st century offers a comprehensive treatment of the
subject. I would also recommend Advanced COBOL by Philippakis and Kazmier as
an additional reference.

You write a job-stream or JCL to run programs on the mainframe. Procure a copy of
Practical MVS JCL written by James Janossy. This book has several job streams that
you can practise on the mainframe.

Using the CICS API and its commands in your COBOL programs, you can make your
programs interactive. You get an immediate response or output to the input you provide.
To learn writing interactive COBOL programs with CICS commands, the book titled
Murach's CICS for the COBOL programmer is good.

To aid your learning, there are many internet websites, blogs discussion forums on the
World Wide Web, which you can visit.

Get into the habit of looking up the IBM-Manuals – the bible of IBM Mainframes,
especially when you run into a problem – for example a program abend (failure). As a
rule-of-thumb refer to the IBM manuals at the IBM Website. All manuals are present in
an electronic format at the IBM Information center. If you do not understand the fine
manual, you should post a question on internet forums or mailing-lists.

HERCULES AND TURNKEY MVS

Hercules emulates the hardware of an IBM mainframe computer. You may install
Hercules on any Windows/Linux/Solaris/Mac OS box. Hercules is like a baby mainframe
computer, but in the form of a software.
114 | P a g e

But, what good is a mainframe without an operating system? IBM has made its MVS
operating system upto release 3.8j (released in the year 1981) freely available.

IBM provides a pre-configured starter system. You take this starter system, code a
bunch of assembler macros to describe the configuration to be installed. This process of
installing an operating system on the mainframe is called System Generation
(Sysgen).

A system programmer called Volker Bandke has developed a ready-to-run turnkey


MVS OS. It relieves you from having to do a Sysgen. The turnkey MVS along with
Hercules gives you a chance to have a mainframe on your PC.

VOLKER BANDKE’S TURNKEY MVS OS

You can download Volker Bandke’s MVS turnkey OS by entering the URL
http://www.ibiblio.org/jmaynard/turnkey-mvs-3.zip in the address bar of your browser.
Get your copy now and enjoy your private Mainframe!

The installation procedure for Volker Bandke’s turnkey OS is available at


https://docs.google.com/document/d/1louAHkDD-
L7m1i84cMk_G7ofCWScRvOvbyFaa9teSL4/edit.

To boot-up and IPL (Initial Program Load) the beast, you can visit http://www.bsp-
gmbh.com/turnkey/cookbook/opmvs.html#MVSIPL.

The Turnkey MVS system on Hercules is excellent learning-aid for a budding


mainframe programmer. I strongly recommend practising COBOL Programs, writing job-
streams and running IBM Software such as IEBGENER, IEFBR14 on your copy of the
Turnkey MVS.

OTHER ALTERNATIVES – GETTING ACCESS TO A MAINFRAME COMPUTER

To practise coding COBOL programs and running them by writing a job (JCL), ordinarily
requires access to a mainframe computer. Just as, you pay for the cellular-phone air-
time, you also need to pay for mainframe computer time (hours) that you use.
Mainframe computer time doesn’t come free. There are many organisations
and coaching centers that rent-out mainframe TSO User-id's for a fixed time-period. In
other words, you generally need to pay for Mainframe computer access.

Dezhi mainframes are the mainframe systems, raised by a group of entrepreneurs


which include – System Programmers, Unix Administrators as well as senior experts in
this field. This is a not-for-profit company that provides free mainframe access to
P a g e | 115

anybody who has a decent Internet connection. I am very much in favour of providing
free mainframes access for a non-commercial motive. This is a fantastic platform, for
somebody who wants to learn mainframe programming at home.

All you need to do is go to the Dezhi Mainframes Internet-Website at


http://zos.efglobe.com/cgi-bin/mainframe/mainuser and register yourself for a new TSO
User-ID and password. You'd get an e-mail confirmation in your mailbox. Get a 3270
terminal emulator software, and connect it to the IP address zos.efglobe.com. You
should be all set.

Fig 10.1 Dezhi mainframe welcome screen


116 | P a g e

WORKING IN A SOFTWARE PROJECT

While reading good reference books and


practising programming on Hercules and Turnkey
MVS facilitates the learning process and makes
you industry-ready, there is no substitute for the
real thing. Industrial experience acts like sand-
paper and smoothens out those rough edges. It
goes without saying that you shall learn much
more about the technology on the job.

If you have graduated out of college and seeking


an assignment as a programmer or you’ve just
landed a job, it is the best time to know, what’s it like working in a software project.

You can’t be sloppy while developing software and building IT systems. It has to be done
in phases, in a well-defined manner. It has definite start and end. Hence, they are called
projects.

Every project – small or big has a business need. The business users often put across
their requirements. These requirements are crude. A functional expert or a business
analyst has several rounds of discussion with the customers and iteratively refines the
requirements. The functionalities or features that are needed from an IT perspective are
then derived from the business requirements. The business analyst then prepares a
business requirements document (BRD) and a functional requirements document
(FRD). The business analyst acts as an intermediary between the customers and the
team of software programmers.

After a thorough analysis of the functionalities, the team of programmers come up with a
technical design or blueprint. When preparing a blue-print, the architecture, the
interfaces, the description of each component, the existing process and the new
proposed solution are to be kept in mind. This blue-print contains pseudo-code for the
software program. You also prepare test cases for every functionality of the software
program that’s affected.

Once the customer signs off on the blue-print, the software code is written. You must be
acquainted with the coding standards (COBOL/RPG/PL1) at your mainframe shop. Its
good to use a checklist. Generally, the software code changes are maintained in
Changeman, Endevor, ISPW or any other change management application. Familiarize
yourself with the product used at your site. After the coding is complete, every
functionality of the software is tested. This is called Unit Testing.

After unit testing is performed by the programmer (self), a separate team is formed to
P a g e | 117

assess the quality of your software code. The Quality Assurance (QA) team runs
dozens of test cases against your software code and checks if the outputs match the
expected results. Your role would be to fix any defects logged by the QA team. Very
often, you need to debug the software code using debuggers like Serena Xpeditor or
CA-Intertest.

The quality assurance team does a hand-over to the User Acceptance Testing team,
comprising of the business folks themselves. After the UAT team does its own round of
testing, the software code is moved to the production environment.
118 | P a g e
P a g e | 119
120 | P a g e

You might also like