®
IBM Software Group
Enterprise COBOL Education Using Rational Developer for System Z
z/OS Terms and Concepts
Jon Sayles, IBM EcoSystems Team
© 2006 IBM Corporation
IBM Trademarks and Copyrights
 © Copyright IBM Corporation 2007,2008. All rights reserved.
 The information contained in these materials is provided for informational purposes
only, and is provided AS IS without warranty of any kind, express or implied. IBM
shall not be responsible for any damages arising out of the use of, or otherwise
related to, these materials. Nothing contained in these materials is intended to, nor
shall have the effect of, creating any warranties or representations from IBM or its
suppliers or licensors, or altering the terms and conditions of the applicable license
agreement governing the use of IBM software. References in these materials to IBM
products, programs, or services do not imply that they will be available in all countries
in which IBM operates.
 This information is based on current IBM product plans and strategy, which are
subject to change by IBM without notice. Product release dates and/or capabilities
referenced in these materials may change at any time at IBM’s sole discretion based
on market opportunities or other factors, and are not intended to be a commitment to
future product or feature availability in any way.
 IBM, the IBM logo, the on-demand business logo, Rational, the Rational logo, and
other IBM Rational products and services are trademarks or registered trademarks of
the International Business Machines Corporation, in the United States, other
countries or both. Other company, product, or service names may be trademarks or
service marks of others.
2
Course Contributing Authors

Thanks to the following individuals, for assisting with this course:
 David Myers/IBM, Ka Yin Lam/IBM,
3
Purpose of This Document
 Course Name: COBOL Foundation Training - with RDz
 Course Description: Learn the COBOL language, RDz and learn z/OS terms, concepts and development skills in this course.
 Pre-requisites: Some experience in a 3rd or 4th Generation Language is expected. SQL is also recommended.
 Course Length: 10 days
 Topics (Agenda)
 Getting Started - installing and configuring RDz - and the course materials, and using Eclipse to edit COBOL
 z/OS Terms and Concepts
 COBOL General Language Rules
 Basic COBOL Statements
 Data records and table handling
 Debugging Programs - Note: Deep dive on using RDz for common COBOL programming errors (001, 0C4, 0C7, infinite loops, fall-thru, etc.)
 Input/Output and Report Writing Patterns
 Sequential File Match/Merge Patterns
 COBOL Subprograms and the Linkage Section
 Structured Programming Concepts and Coding Patterns
 Advanced Character Manipulation, COBOL Intrinsic Functions, Date and Time coding patterns, and Language Environment calls
 OS/390 Concepts and JCL
 Compile/Link & Run Procs on the mainframe
 Indexed file Coding Patterns
 Sort/Merge and Master File Update Coding Patterns
 Accessing DB2 Data and Stored Procedures
 COBOL in the Real World:
– CICS - lecture only
– IMS (DL/I and TM) - ditto
– Batch processing - ditto
– Java calling COBOL
– COBOL and XML Statements
– SOA and COBOL - creating and calling Web Services
– Web 2.0 using Rich UI
4
Course Details
 Audience
 This course is designed for application developers who have programmed in
some language before, and who wish to learn COBOL.
 Prerequisites
 This course assumes that the student has the basic knowledge of IS
technologies, data processing, software and have programmed for at least
two or more years in a language such as: Java, VB, RPG, PL/1, Pascal, or
some 4th Generation Language or tool.
 Knowledge of SQL (Structured Query Language) for database access is
assumed as well.
 Basic PC and mouse-driven development skills is also assumed.
 Finally, it is assumed that you have been following along in this course, and
have successfully completed the learning modules in sequence.
 Or have the equivalent COBOL background obtained through some other form of
COBOL study or on-the-job work.
5
UNIT
z/OS Terms and Concepts
Topics:
 z/OS Hardware Terms and Concepts
 z/OS Software Terms and Concepts
 COBOL and z/OS Integration
 Appendices
6
Topic objectives
After completing this topic, you should be able to:
Describe the characteristics and define the following IBM hardware:





Mainframes
3390 disk packs
LPARs
EBCDIC
Multi-tier environments
7
Why Learn About the z/OS?
1. Very difficult to re-engineer the (up to 40 years of) production business functionality
running on a mainframe (generally not cost-efficient & risky)
2. What they do for I/T shops – they do extremely well (proven & reliable):
 Large-scale capacity – by every standard of measurement:
 Support for 1,000s, 10,000s, 100,000s concurrent users
 100,000s  1,000,000s TPS (transactions per/second)
 Hosting for dozens/hundreds of databases/files, measured in terabytes
 High-speed/secure/stable network access
 Able to support mixed environments and workloads.
 One box often hosts:
 OLTP (On-Line Transaction Processing), Batch processing, Ad-hoc processing
 Several testing regions
 Multiple logical (virtual) "machines" split from single box
 Even runs multiple operating systems concurrently (z/OS, Linux, z/VM)
 Extremely stable/secure production environment:
 If a mainframe box goes down once/per year it's unusual
 Recovery and data integrity mechanisms unparalleled
 Efficient, self-regulating operating system:
 Slicing/Prioritizing CPU cycles flexible, simple, cost-effective MIPS
Prior generation names:
 OS/390, s/390 (system 390) …. s/370 (system 370), MVS (Multiple Virtual Storage)
8
Terms and Concepts – Hardware
IBM z/10 series
IBM z/990 series
IBM z/900 series
IBM s/90 G5/G6
IBM z/Series 800
Smallest workloads
(Linux) - smaller workloads
"The zSeries is the enterprise class e-business server optimized for integration, transactions and data of the next
generation e-business world."
IBM i/900 series
Mid-range Mainframe
Formerly: AS/400
The IBM TotalStorage Enterprise Storage Server (ESS) Model 800
Capacity up to 56 Terabytes (that's 5,600 Gigabytes)
Prior generation of technology names: DASD (Direct Access Storage Device
9
Logical Partition – LPAR





LPARs are the equivalent of a separate mainframe for most practical purposes
Each LPAR runs its own operating system
Devices can be shared across several LPARs
Processors can be dedicated or shared
When shared each LPAR is assigned a number of logical processors (up to the
maximum number of physical processors) and a weighting
 Each LPAR is independent
Development
z/OS
Test
z/OS
Production
z/OS
…
Linux
Linux
Linux
LPARs
CPU
CPU
Physical Processors
READ
CPU
WRITE
Main Memory
10
CPU
z/10
Disk Devices
IBM 3390 Disk Unit
channels
IBM 3990
Control Unit
 Current mainframes use 3390 disk devices
 The original configuration was simple with a controller connected to the processor
and strings of devices attached to the back end
 The DS8000 Enterprise Storage Server is a device that can manage disk devices
 It emulates a large number of control units and 3390 disks. It can also be
partitioned and connect to UNIX and other systems as SCSI devices.
 There are 11/196 Terra-bytes of disk space up to 32 channel interfaces, 16/256
Giga-bytes cache and 284/Mega-Bytes of non-volatile memory
11
EBCDIC
 The IBM S/360 through to
the latest zSeries
machines use the
Extended Binary Coded
Decimal Interchange
character set for most
purposes
 This was developed
before ASCII and is also
an 8 bit character set
 z/OS Web Server stores
ASCII data as most
browsers run on PCs
which expect ASCII data
 UNICODE is used for
JAVA on the latest
machines
12
Modern Multi-Tier Mainframe Systems
Client Tier
Browser
Client
Middle Tier
Business Application
Server
Presentation
Logic
Legacy
Systems
Business Objects
Browser
Client
Database
Server
Client
See Slide Notes
Enterprise Tier
13
UNIT
z/OS Terms and Concepts
Topics:
 Hardware Terms and Concepts
 z/OS Software Terms and Concepts
 COBOL Program and z/OS Integration
 Appendices
14
Topic objectives
After completing this topic, you should be able to:
Describe the characteristics and define the following IBM software terms and
concepts:
 z/OS and mainframe operating system software
 Batch processing
 Online applications
– Transactions
– BMS
– MFS
 Mainframe file and database systems:
– VSAM/QSAM files
– DL/I (IMS) databases
– DB2 databases
 Mainframe development software (traditional)
– Tools
– Development process
– Procedural languages
15
Terms and Concepts – Operating Systems
Mainframe Description
Network/PC Equivalent
======== ====================================================== ======================
z/OS
Latest mainframe operating system
UNIX/Linux/Windows
"z" refers to 64-bit addressing "z-architecture" – z/OS is "Self-optimizing,
Self-configuring and Self-healing". z/OS supports Java (6), XML, DB2,
TCP/IP and can host the Linux operating system as running task.
OS/390
Previous generation mainframe operating system
MVS
Mainframe operating system during late 70's, 80's early 90's
Multiple Virtual Storage – virtually partition real storage to allow
for multiple applications – all with access to max addressable memory
z/VM
Latest operating system for mid-size mainframes. VM (per se') is prior
generation of this O.S. development tools under VM include:
CMS (same as TSO) and Xedit (similar to ISPF/Edit).
Windows NT Win98
Win95
VSE/ESA Operating system for small mainframes. Its predecessor was DOS/VSE.
TSO
Time Sharing Option – an operating system within z/OS
TSO provides time slicing (access to mainframe cycles) for
developers coding, compiling, testing, etc.
JCL
Job Control Language – a language for specifying the properties
and characteristics of batch application "jobs".
Jobs are the basic unit of work to the mainframe operating system.
16
Korn shell scripts
.CMD files
Traditional "Online" …vs… "Batch" Applications
Mainframe Description
Network/PC Equivalent
======== =======================================================
===================
Online
Access to production applications and data from connected 3270 terminals
WebSphere, Tomcat…
is done through Online systems. Characteristics: extremely high throughput, sub-second responsetime, limited data access, mix of Read/Only, Insert, Update, Delete. Access from 3270 devices to the
mainframe in is traditionally through VTAM (especially if running under SNA). Today's Online
systems often connect web pages to back-office resources.
Batch
Access to production applications and data offline (after 7:00 PM)
UNIX Korn Shell, .cmd files
is done through Batch systems. Characteristics: extremely high volume (process from 100,000s to
1,000,000s of transactions in a single job. The "job" is the unit of work, defined by JCL (Job Control
Language) and consists of dozens to 100s of individual programs linked together to process data.
Online Systems–Teleprocessing Region(s)
3270 users
Batch Region(s)
JCL JOBs
Online Resource
Adaptors
Online
Files and
Databases
Development
TSO users
VTAM
Online
Online
Applications
Online
Applications
Applications
---
z/OS
and
z/10
Batch
Batch
Jobs
Batch
Job
Jobs
CICS or IMS TM
17
Offline (batch)
Files and
Databases
z/OS Online Application Systems
Mainframe Description
Network/PC Equivalent
======== =======================================================
===================
C.I.C.S.
Customer Information Control System. IBM's oldest teleprocessing monitor. WebSphere, Tomcat…
Runs as a job under the operating system. Coordinates all resources necessary for secure units of
work (transactions) – two-phase commit across multiple data sources, etc. Screens defined with BMS
maps. Other resources defined to C.I.C.S. system tables through RDO (Resource Definitions Online)
Note that screens for z/OS  3270. Screens for I/Series (AS/400)  5250
IMS/TM
Information Management System/Transaction Manager. IBM's dedicated
WebSphere, Tomcat…
IMS TP monitor. Same functionality as C.I.C.S. – but different product. No application program
access to native VSAM files (directly). Typically installed in "IMS shops". TP calls through 'CBLTDLI'
interface.
Web/REST services have
found their way into the
mix as well – in accessing
online data and process
C.I.C.S. Region(s)
IMS/TM Region(s)
3270 – MFS Maps
3270 - BMS Maps
VTAM
VTAM
CICS Transaction Gateway
DB2
DL/I
VSAM
C.I.C.S.
C.I.C.S.
Application
C.I.C.S.
Application
Application
IMS Connect
z/OS
and z/10
CICS Region
IMS/TM
IMS/TM
Applications
IMS/TM
Applications
Application
IMS TM Region
18
DB2
DL/I
GSAM
Traditional Batch Processing Software
Mainframe Description
Network/PC Equivalent
======== =======================================================
===================
Tivoli
Production (and Integration/Q.A. test) Job Scheduler
Embarcadero
CA-7
Automates production control over: job queues, security, priority, scheduling,
schedule Ids, job (pre and post) processing requirements, documentation
Ad Hoc
TSO/ISPF has facilities to create (edit) and submit JCL jobs.
Korn Shell, .cmd file
Both in the background (running under the control of the Job initiator and queues) and
in the foreground (running under TSO itself – almost like dedicated online process).
REXX execs and CLISTs (same as .cmd files) can also be executed in the TSO foreground for various
reasons (usually utilities like copy/delete files, etc.)
Batch Region(s)
JES
Queue
z/OS
and box
Batch
Jobs
Batch
Job
Batch
Jobs
Development Subsystem
TSO/ISPF users
JES
JOB
Initiator(s)
JCL JOBs
Tivoli
CA-7
Offline (batch)
Files and
Databases
19
REXX execs
CLISTs
Databases – DB2
Mainframe Description
Network/PC Equivalent
======== ====================================================
=====================
DB2
IBM's flagship relational DBMS. Has close to 100% market share
Oracle, SQLServer, etc.
on the mainframe (no significant competitors on z/xxx machines).
- Most concepts and standards of PC/UNIX relational databases apply to DB2
(tables, rows, indexes, views, stored procedures, etc.)
- DBA-level (physical) structures very different (as they are with most RDBMS products (see below)
- And on the mainframe, almost all access to data is done through static "plans" which are
bound SQL statements stored in the DB2 Catalog. DB2 supports Stored Procedures & dynamic SQL
DB2
Application Program
Database – logical artifact
Catalog
Tablespace – physical artifact
Table
Table
Plan
Plan
Plan
Index
System Tables
20
…
Exec SQL
Call 'plan'
…
End-Exec.
Databases – IMS
Mainframe Description
Network/PC Equivalent
======== ====================================================
====================
IMS-DL/I IBM's hierarchical DBMS. Data is stored in inverted tree structures called
ISAM (indexed) files
"segments". Note that IMS/ESA has two components (IMS/DB and IMS/TM – formerly IMS/DC)
- The segments (and their relationships) are defined with in a proprietary specification block (file)
known as a DBD (Data Base Descriptor).
- Applications access IMS databases through an application view defined in a specification known as a
PSB (Program Specification Block) – which is composed of 1-Many PCBs (Program Communications
Block). Each PCB is a view a single database segment. Access to IMS databases is through a call
interface (Call using format – similar to method calls passing parameters and returning data).
- IMS database technology is also referred to as: IMS DB … and DL/1 (Data Language 1 – which is
like SQL for accessing IMS databases. DL/1 (or DL/I) is a complex and sophisticated language (read
difficult) language. The business semantics of most IMS databases is shared between the
application program's DL/1 logic (sequenced access calls) and the data per se'.
IMS Application Program
Suppliers
Parts
Address
PurchaseOrders
21
…
Call 'CBLTDLI'
USING SUPP-PCB,
IO-AREA,
DB-SSA.
Files and Databases – VSAM
Mainframe Description
Network/PC Equivalent
======== ========================================================= ===================
VSAM
IBM's foundation data storage system. Basically comprised of indexed
ISAM (indexed) files
files – and applications and system utilities that access the indexed data.
- Access is either direct (through primary key), sequential (read until condition),
or through secondary index file (similar to a WHERE clause).
- Syntax/access to VSAM (Virtual Storage Access Method) files in most IBM languages is through
direct statements: OPEN INPUT file, check status… READ file, check status. OPEN OUTPUT FILE…
UPDATE file, INSERT into file, CLOSE file. (native language access – not Call Interface).
- The business semantics of almost all VSAM files is shared between the application program's data
access logic (sequenced calls) and the data per se'.
VSAM Application Program
…
OPEN input SUPPLIER-FILE
if SUPPLIER-STATUS = '00'
subtract APPL-RESULT from
APPL-RESULT
else add 12 to ZERO giving
APPL-RESULT end-if
Suppliers
Secondary
Index File
Supplier
Zip Codes
…
22
Files and Databases – Other
Mainframe Description
Network/PC Equivalent
======== ====================================================
====================
QSAM
Queued Sequential Access Management (aka "flat" files).
Sequential files…
Non-indexed files that hold (almost always) batch data for bulk processing. Often historical data,
back-ups and image-copy data.
IDMS
Non-IBM proprietary files in "network/CODASYL" data model
Indexed files…
Originally offered by Cullinane software (Boston). Later purchased by Computer Associates.
Many large Fortune 1000 IDMS users. IDMS-ADSO (CICS for IDMS)
ADABAS Non-IBM proprietary files in "indexed/table" data model
Indexed files…
Originally offered by SoftwareAG, ADABAS has a large install base (especially in U.S. government
and state offices. Coupled with the Natural programming language (a COBOL-like 3GL) there are
still lots of ADABAS installations. Natural/Adabas. EGL – Natural  EGL Migration.
 EBCDIC …vs… ASCII - internal data storage format 
 It is worth noting that virtually all mainframe data is internally stored using in EBCDIC format.
 This means that some software will have to translate bytes transmitted, between mainframe/PC
 It also means that (text) data sorted on the mainframe will sort in a different order on the PC
23
Traditional Development Environment
Mainframe Description
======== ====================================================
TSO
Time Sharing Option. Basically, a "job" that runs under z/OS responsible
for managing program development resources (files, Login, jobs, etc.)
ISPF
Network/PC Equivalent
====================
UNIX/Windows O.S.
Interactive Systems Programming Facility. Each individual developer's custom
RDz
Development IDE, that allows programmers to: Create new source files and manage them.
- Edit source and data files, interact with common version control software,
compile/link/run/test programs (usually by submitting background "jobs")
through JCL – but often shops provide "foreground" (interactive) facilities for this common process.
- Developers are allowed a [relatively] wide margin to customize their own unique environments.
- And shops almost always created "system software" tools that snap-in to ISPF – maintaining
standards, raising productivity, and providing easier access to in-house functions – often written
in REXX or CLIST language.
- Sometimes called: SPF (for short). C.A. offers a similar facility, named: ROSCOE.
Version
Many different competing version control and "library management" facilities
Control
Available on the mainframe. They all do (roughly) the same thing. Most shops use:
Software CA-Endevor, Serena-Changeman, IBM-SCLM, CA-Panvalet, CA-Librarian
24
ClearCase
Terms and Concepts – TSO/ISPF Development
ISPF "Main Menu" of
development options
ISPF Edit (of JCL file)
ISPF
Utility
Allocate
Dataset
(file)
http://publibz.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ISPZEM00/CONTENTS?SHELF=&DT=20001109114810#3.1.19
25
Terms and Concepts – Compile/Link/Run Environment
Source Module
JES Reader
Similar to C, C++, and other 3 and 4GLs…

Object Module 
26
Errors are returned to the JES reader
(usually visible through an option under
TSO)

The .OBJ format of the program is linked to
a "load module" by the Link Editor – which
resolves all external references and calls

The Load Module is reference in JCL – by
naming the entry point of the initial program
to be launched (like main() in Java)
Load Module
//EXEC PGM=LoadModule…
Source is compiled to to .OBJ (machine
code)
Development File Types - Introduction


In a development environment, there are two
file types:
 Files that hold application source
 Files that hold application data
Both are created (allocated) using some form
of z/OS Job



JCL Utility program
ISPF panel – which creates and submits JCL as
a foreground task
Files are usually referred to as Data Sets –
and are allocated on a disk pack with a
volume serial number – that uniquely
identifies the disk in the LPAR
Application source files:

Partitioned Data Set (PDS)




Test Data Sets

Many and varied types:





Sequential Data Set


A collection of like-type sequential files:
COBOL, JCL, CLIST.
Individual files are termed "members" of the
PDS – which is the "Data Set"
You can almost think of them as: records
(individual members) within an array (the PDS
Data Set)
Individual files – can be used for: Test data
(QSAM data sets), source files (not typically,
but possible),



A specialized form of the PDS is a Load Library
– which is a PDS that contains "Load Modules"
Each Load Module is the compiled and linked
version of program source
Space is allocated typically in disk pack:


Executables

Fixed sequential
Variable Length Sequential
Print files
Load libraries
Partitioned Data Sets
Tracks
Cylinders
Records within a file:


Have a length - LRECL
Are aggregated into "blocks" – which become the unit of I/O transfer

27
BLKSIZE
Programming Languages
Mainframe Description
Network/PC Equivalent
======== ====================================================
====================
COBOL
Common Business Oriented Language
BASIC
- A 50+ year-old language, that is still being heavily invested in – although not nearly at
the same rate it was, during the 60's, 70's and 80's (or even 90's). COBOL is an English-like
wordy language. That is optimal for applications with long shelf-lives – due to it's verbose (I.e.
easy-to-read) nature, universality, and it's run-time optimization.
- COBOL programs have a DATA DIVISION – analogous to a class's attributes, and a
PROCEDURE DIVISION – analogous to a class's methods.
- Data structures and files are defined through what are called copybooks – which describe the
individual fields and field definitions (data format, etc.). Copybooks are downloaded and become
RRD classes, when accessed through our mainframe integration technology.
HLASM
High Level Assembler
High Level Assembler is an IBM licensed program that helps you develop programs
and subroutines to provide functions not typically provided by other symbolic
languages, such as COBOL, FORTRAN, and PL/I.
PL/I
An elegant, 3rd generation, imperative, structured programming language.
Used a lot in scientific and financial shops. Not as universal as COBOL.
RPG
Report Program Generator. A high-level 3GL – used extensively on the Power i
Java/C/C++ All of these languages have compilers and tools available on z/OS
28
Assembler
BASIC
BASIC
Java/C/C++
Software – Programming Languages – "Hello World" Comparison
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLOWORLD.
000300*
000400 ENVIRONMENT DIVISION.
000500 CONFIGURATION SECTION.
000600 SOURCE-COMPUTER. IBM-COBOL.
000700 OBJECT-COMPUTER. IBM-COBOL.
000800
000900 DATA DIVISION.
001000 FILE SECTION.
001100
001200 PROCEDURE DIVISION.
001300 DISPLAY "Hello world!".
001400 STOP RUN.
COBOL program
HELLO: PROCEDURE OPTIONS (MAIN);
/* A PROGRAM TO OUTPUT HELLO WORLD */
FLAG = 0; LOOP:
DO WHILE (FLAG = 0);
PUT SKIP DATA('HELLO WORLD!');
END LOOP;
END HELLO;
PL/I
HELLOPRT START 0
IN THE BEGINNING...
PRINT NOGEN
SPARE US THE MACRO EXPANSIONS
BEGIN
SAVE (14,12)
SAVE INPUT REGISTERS
LR
12,15
WHERE ARE WE?
USING HELLOPRT,12
RIGHT HERE
ST
13,SAVE+4
SAVE OLD SAVE AREA ADDRESS
LA
11,SAVE
POINT TO NEW SAVE AREA
ST
11,8(13)
IN OLD SAVE AREA
LR
13,11
MOVE SAVE AREA ADDRESS
*
* WRITE "HELLO, WORLD!" ON WHATEVER HAS BEEN SET UP AS SYSPRINT
IN
* THE INVOKING JCL (NO, UNIX DOESN'T HAVE A MONOPOLY ON DEVICE* INDEPENDENT I/O!)
*
DOPUT
EQU
*
PUT
SYSPRINT,HELLOMSG WRITE THE MESSAGE
B
DOPUT
FOREVER...
*
* THIS CODE WILL NEVER BE REACHED, BUT IS INCLUDED FOR
COMPLETENESS
*
L
13,SAVE+4
GET OLD SAVE AREA BACK
RETURN (14,12),RC=0
TO THE OPERATING SYSTEM
*
* FILE AND WORK AREA DEFINITIONS
*
SAVE
DS
18F
LOCAL SAVE AREA
HELLOMSG DC
C' HELLO, WORLD!'
SYSPRINT DCB
DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,
X
RECFM=FA,LRECL=133,BLKSIZE=133
END
BEGIN
HLASM program
program
29
z/OS Links and
 Here are some links for additional study on mainframe software terms and
concepts:
http://publib.boulder.ibm.com/infocenter/zos/basics/index.jsp
 An excellent set of organized categories of info – that backstop a lot of the material in this
Unit
http://en.wikipedia.org/wiki/Z/OS
 What can we say… it's Wikipedia
http://www.trainersfriend.com/Papers/Future_of_Mainframe.pdf
 A somewhat advanced but excellent next-level-down dive on the technology terms and
concepts in this Unit
http://www-03.ibm.com/systems/z/destinationz/
 IBM's site for mainframe – and z/topic communities
Knowledge
30
UNIT
z/OS Terms and Concepts
Topics:
 Hardware Terms and Concepts
 z/OS Software Terms and Concepts
 COBOL Program and z/OS Integration
 Appendices
31
Topic objectives
After completing this topic, you should be able to:
Describe how COBOL programs:
 Are executed at run-time by operating system
 Attach to and read/write data from external data
 Interface with other business logic
32
Review – Online and Batch
Recall from the previous slide that there are two "modes" of z/OS
applications:
Batch: Where "Jobs" are executed through "JCL" (Job Control Language) cards that are
read and understood by z/OS
//EXEC PGM=MYPROG,…
//JOB
J
E
S
JOBNAME=MYJOB,…
JCL
LOADLIB
z/OS
Compiled
Programs
Online: Where transactions ("trancodes") are entered into a z/OS sub-system that "listens"
for them. These sub-systems (either IMS/TM or CICS) are responsible for:
– Security – ensuring authentication and authorization from those entering the TRANCODE and
connecting to the online system
– Attaching the proper initial process (COBOL program) responsible for handling the transaction
– More…

TRANCODE
C
I
C
S
z/OS
33
LOADLIB
Compiled
Online
Programs
Batch Processing (only slightly) Deeper Dive
There are only a few places in a batch COBOL program that interface with
z/OS. It's easiest to understand by studying a little (!) JCL
JCL is an operating system language that has three major keywords (aka "cards")
//JOBname JOB,…,TIME=(1)
//STEPNAME EXEC PGM=MYPROG,
//
PARM=AABBCC,…
//STEPLIB DD DSN=MYLOADLIB
//DDName DD DSN=MY.zOS.FILE,...
// …dataset characteristics…
Note – there's a LOT more to JCL. We'll cover it later on
in the course, when you get to hit the mainframe.
//JOBname JOB – describes the characteristics of the
batch job, including how much CPU time it is allowed.
Note that the TIME= parameter will kill programs in
infinite loops (although it won't solve your coding problem  )
//Stepname EXEC – tells z/OS what
program to execute (like main in Java or
C/C++)
//STEPLIB – tells z/OS the name of the
library to search for the compiled program
//DDName – DD statement. Connects your
program's I/O statements with z/OS datasets.
DSN= "fully-qualifies" the name of the dataset
(so z/OS can find it)
Your program needs one //DD statement for
every file it accesses. And where's the hook for
that? (next slide…)
34
LOADLIB
Compiled
Programs
Dataset
z/OS
QSAM, VSAM
DL/I files
COBOL and Batch
In COBOL – every QSAM and VSAM file you access will need a "SELECT/ASSIGN" statement – that
essentially defines a "logical" external file name which must have a matching //DD card in the JCL that runs
your code. See the pictures below.
//MYFILE - is the logical file name that connects the COBOL
//MYFILE DD DSN=ABC.MYFILE,...
//
…dataset characteristics…
program's I/O statements (internal file variable name) to …
DSN=ABC.MYFILE – which is the physical (external) filename that
lives on a 3990 disk pack attached z/OS
35
COBOL and Online Transactions
 Online applications run under the supervision of a transaction management system (in z/OS
either: CICS or IMS TM).
 The transaction manager connects to a series of system tables with entries defined for
resources necessary to fulfill run-time transaction requests:

TRANCODE
C
I
C
S
I
M
S
z/OS
T
M
CICS or IMS "System Tables"
Terminals (LTERM)
Device IDs allowed to hit the online region
Users (User-ID/Password)
Authentication/Authorization
Trancode (transaction code)
List of actual trancodes, and which program to
load and execute for each trancode
File (or database)
Entry that acts like a batch DD card, and
defines which files can be accessed online
…
Many other control block definitions are needed to
support a production online transaction system
…
36
UNIT
z/OS Terms and Concepts
Topics:
 Hardware Terms and Concepts
 z/OS Software Terms and Concepts
 COBOL Program and z/OS Integration
 Appendices
37
z/OS – COBOL
Java - Equivalence Chart
Mainframe/COBOL/z/OS
I-Net/Java
===================================
===============================================
Program field or variable

Class or Local method Attribute
Paragraph 
Method
Program (source) 
Class Definition (.java file)
Load Module (.EXE file) 
Compiled Class (.class file)
Execute or run a Load Module 
Object instance of a Class, running in Java/VM
Load Modules in a Load Library 
Classes defined in Packages
Program passed/returned parameters 
Method passed/returned parameters
JCL
.cmd/.shell script (UNIX)
Requirements-Based Vocabulary(OO COBOL) 
User Defined Datatype (Class)
REDEFINES clause 
Class and Datatype Casting/conversion
Program/sub-routine calls 
Java method calls
Call to System/Utility program 
Java or NeuVis API method calls
RDBMS/Database 
RDBMS/Database
Table 
Persisted Class data
Table row 
Single object persisted data
SQL statement/Stored Procedure 
same … but all dynamic SQL using JDBC
CICS/IMS DC 
Application Server
BMS Map/MFS 
Java Servlet/HTML Page
CICS Queue/IMS DC Scratch Pad 
EJB Session Object
CICS In/Out Maps, IMS MFS MID/MOD
EJB Request/Response Objects
38