Professional Documents
Culture Documents
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.
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
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
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
LPARs
CPU CPU Physical Processors CPU CPU
READ WRITE
z/10
Main Memory
10
Disk Devices
IBM 3990
channels
Control Unit
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
Browser Database
Client Server
Client
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
Mainframe Description Network/PC Equivalent
======== ====================================================== ======================
======== ====================================================== ======================
z/OS Latest mainframe operating system UNIX/Linux/Windows
z/OS Latest mainframe operating system UNIX/Linux/Windows
XP
XP
"z" refers to 64-bit addressing "z-architecture" – z/OS is "Self-optimizing,
"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,
Self-configuring and Self-healing". z/OS supports Java (6), XML, DB2,
TCP/IP and can host the Linux operating system as running task.
TCP/IP and can host the Linux operating system as running task.
OS/390 Previous generation mainframe operating system Windows NT Win98
OS/390 Previous generation mainframe operating system Windows NT Win98
MVS Mainframe operating system during late 70's, 80's early 90's Win95
MVS Mainframe operating system during late 70's, 80's early 90's Win95
Multiple Virtual Storage – virtually partition real storage to allow
Multiple Virtual Storage – virtually partition real storage to allow
for multiple applications – all with access to max addressable memory
for multiple applications – all with access to max addressable memory
z/VM Latest operating system for mid-size mainframes. VM (per se') is prior
z/VM Latest operating system for mid-size mainframes. VM (per se') is prior
generation of this O.S. development tools under VM include:
generation of this O.S. development tools under VM include:
CMS (same as TSO) and Xedit (similar to ISPF/Edit).
CMS (same as TSO) and Xedit (similar to ISPF/Edit).
VSE/ESA Operating system for small mainframes. Its predecessor was DOS/VSE.
VSE/ESA Operating system for small mainframes. Its predecessor was DOS/VSE.
TSO Time Sharing Option – an operating system within z/OS
TSO Time Sharing Option – an operating system within z/OS
TSO provides time slicing (access to mainframe cycles) for
TSO provides time slicing (access to mainframe cycles) for
developers coding, compiling, testing, etc.
developers coding, compiling, testing, etc.
JCL Job Control Language – a language for specifying the properties Korn shell
JCL Job Control Language – a language for specifying the properties Korn shell
scripts
scripts
and characteristics of batch application "jobs".
16 .CMD
Traditional "Online" …vs… "Batch" Applications
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== =======================================================
======== =======================================================
===================
===================
Online Access to production applications and data from connected 3270 terminals WebSphere,
Online Access to production applications and data from connected 3270 terminals WebSphere,
Tomcat…
Tomcat…
is done through Online systems. Characteristics: extremely high throughput, sub-second response-
is done through Online systems. Characteristics: extremely high throughput, sub-second response-
time, limited data access, mix of Read/Only, Insert, Update, Delete. Access from 3270 devices to the
time, 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
mainframe in is traditionally through VTAM (especially if running under SNA). Today's Online
systems often connect web pages to back-office resources.
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
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
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
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
Online Systems–Teleprocessing dozens to 100s of individual
Region(s) programs
Batch linked together
Region(s) --- totoprocess data.
Development
Language) and consists of
Online Systems–Teleprocessing Region(s)dozens to 100s of individual programs linked
Batch Region(s) together
--- process data.
Development
Batch Region(s) --- Development
3270 users TSO users
3270 users VTAM TSO users
VTAM
Online Resource JCL JOBs
Online Resource
Adaptors
JCL JOBs
Adaptors
Online
Online
Online z/OS
Online
Applications
Online z/OS Batch
Applications
Online
Applications and Batch
Batch Offline (batch)
Online Applications
Applications and Jobs Offline (batch)
Online Batch
Batch
Jobs Files and
Applications z/10 Batch
Job Files and
Files and z/10 Job
Files and
CICS or IMS TM Jobs Databases
Databases CICS or IMS TM Jobs Databases
Databases 17
z/OS Online Application Systems
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== =======================================================
======== =======================================================
===================
===================
C.I.C.S. Customer Information Control System. IBM's oldest teleprocessing monitor. WebSphere,
C.I.C.S. Customer Information Control System. IBM's oldest teleprocessing monitor. WebSphere,
Tomcat…
Tomcat…
Runs as a job under the operating system. Coordinates all resources necessary for secure units of
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
work (transactions) – two-phase commit across multiple data sources, etc. Screens defined with
BMS
BMS
maps. Other resources defined to C.I.C.S. system tables through RDO (Resource Definitions Online)
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
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,
IMS/TM Information Management System/Transaction Manager. IBM's dedicated WebSphere,
Tomcat… IMS TP monitor. Same functionality as C.I.C.S.
Web/REST – buthave
services different product. No application program
Tomcat… IMS TP monitor. Same functionality foundas C.I.C.S. – but
their way into thedifferent product. No application program
access to native VSAM files (directly).mix
Typically
as well – ininstalled
accessing in "IMS shops". TP calls through 'CBLTDLI'
access to native VSAM files (directly).
C.I.C.S. Region(s) Typically
online installed in "IMS shops". TP calls
data and process throughRegion(s)
IMS/TM 'CBLTDLI'
C.I.C.S. Region(s)
interface. IMS/TM Region(s)
interface. 3270 – MFS Maps
3270 - BMS Maps 3270 – MFS Maps
3270 - BMS Maps
VTAM VTAM
VTAM VTAM
CICS Transaction Gateway IMS Connect
CICS Transaction Gateway IMS Connect
C.I.C.S. IMS/TM
C.I.C.S.
C.I.C.S. IMS/TM
IMS/TM
C.I.C.S.
Application
C.I.C.S. z/OS IMS/TM
Applications
IMS/TM
Application
C.I.C.S.
Application z/OS Applications
IMS/TM
Applications DB2
DB2 Application
Application Applications
Application DB2
DB2 Application and z/10 Application
DL/I and z/10 DL/I
DL/I
DL/I
VSAM CICS Region IMS TM Region GSAM
VSAM CICS Region 18
IMS TM Region GSAM
Traditional Batch Processing Software
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== =======================================================
======== =======================================================
===================
===================
Tivoli Production (and Integration/Q.A. test) Job Scheduler (J.E.S.)
Tivoli Production (and Integration/Q.A. test) Job Scheduler (J.E.S.)
Embarcadero
Embarcadero
CA-7 Automates production control over: job queues, security, priority, scheduling,
CA-7 Automates production control over: job queues, security, priority, scheduling,
schedule Ids, job (pre and post) processing requirements, documentation
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
Ad Hoc TSO/ISPF has facilities to create (edit) and submit JCL jobs. Korn Shell, .cmd
file
file
Both in the background (running under the control of the Job initiator and queues) and
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).
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
REXX execs and CLISTs (same as .cmd files) can also be executed in the TSO foreground for
various
various Batch Region(s) Development Subsystem
Batch(usually
reasons Region(s)
utilities like copy/delete files, etc.) Development Subsystem
reasons (usually utilities like copy/delete files, etc.) TSO/ISPF users
JES TSO/ISPF users
JES
Queue JES
Queue JES JCL JOBs
Batch JOB JCL JOBs
Batch JOB
Jobs Initiator(s)
Jobs Initiator(s)
Batch
z/OS Batch
z/OS Job
and box Batch Job Offline (batch)
Offline (batch) Tivoli
Tivoli REXX execs
and box Batch Files and REXX execs
Jobs Files and CA-7
CA-7 CLISTs
Jobs Databases CLISTs
Databases
19
Databases – DB2
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== ====================================================
======== ====================================================
=====================
=====================
DB2 IBM's flagship relational DBMS. Has close to 100% market share Oracle, SQLServer,
DB2 IBM's flagship relational DBMS. Has close to 100% market share Oracle, SQLServer,
etc.
etc.
on the mainframe (no significant competitors on z/xxx machines).
on the mainframe (no significant competitors on z/xxx machines).
- Most concepts and standards of PC/UNIX relational databases apply to DB2
- Most concepts and standards of PC/UNIX relational databases apply to DB2
(tables, rows, indexes, views, stored procedures, etc.)
(tables, rows, indexes, views, stored procedures, etc.)
- DBA-level (physical) structures very different (as they are with most RDBMS products (see below)
- 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"
plans which are
- And on the mainframe, almost all access to data is done through static " plans"
plans which are
bound SQL statements stored in the DB2 Catalog. DB2 supports Stored Procedures & dynamic
bound SQL statements stored in the DB2 Catalog. DB2 supports Stored Procedures & dynamic
SQL
SQL
DB2
DB2
Application Program
Database – logical artifact Application Program
Database – logical artifact Catalog
Catalog …
…
Tablespace – physical artifact Plan Exec SQL
Tablespace – physical artifact Plan
Plan Exec SQL
Plan
Plan Call 'plan'
Plan Call 'plan'
Table Table Index …
System Tables …
System Tables End-Exec.
End-Exec.
20
Databases – IMS
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== ====================================================
======== ====================================================
====================
====================
IMS-DL/I IBM's hierarchical DBMS. Data is stored in inverted tree structures called ISAM (indexed)
IMS-DL/I IBM's hierarchical DBMS. Data is stored in inverted tree structures called ISAM (indexed)
files
files
"segments". Note that IMS/ESA has two components (IMS/DB and IMS/TM – formerly IMS/DC)
"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)
- The segments (and their relationships) are defined with in a proprietary specification block (file)
known as a DBD (Data Base Descriptor).
known as a DBD (Data Base Descriptor).
- Applications access IMS databases through an application view defined in a specification known as
- Applications access IMS databases through an application view defined in a specification known as
a
a
PSB (Program Specification Block) – which is composed of 1-Many PCBs PCB (Program
PSB (Program Specification Block) – which is composed of 1-Many PCBs PCB (Program
Communications Block). Each PCB is a view a single database segment. Access to IMS databases is
Communications Block). Each PCB is a view a single database segment. Access to IMS databases is
through a call
through a call
interface (Call using format – similar to method calls passing parameters and returning data).
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
- 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
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
difficult) language. The business semantics of most IMS databases is shared between the
application program's DL/1 logic (sequenced access calls) and the dataIMS per
IMS
Application Program
se'.
Application Program
application program's
Suppliers DL/1 logic (sequenced access calls) and the data per se'.
Suppliers …
…
Call 'CBLTDLI'
Call 'CBLTDLI'
USING SUPP-PCB,
USING SUPP-PCB,
IO-AREA,
IO-AREA,
Parts Address PurchaseOrders DB-SSA.
Parts Address PurchaseOrders DB-SSA.
21
Files and Databases – VSAM
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== ========================================================= ===================
======== ========================================================= ===================
VSAM IBM's foundation data storage system. Basically comprised of indexed ISAM (indexed)
VSAM IBM's foundation data storage system. Basically comprised of indexed ISAM (indexed)
files
files
files – and applications and system utilities that access the indexed data.
files – and applications and system utilities that access the indexed data.
- Access is either direct (through primary key), sequential (read until condition),
- Access is either direct (through primary key), sequential (read until condition),
or through secondary index file (similar to a WHERE clause).
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
- 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
direct statements: OPEN INPUT file, check status… READ file, check status. OPEN OUTPUT
FILE…
FILE…
UPDATE file, INSERT into file, CLOSE file. (native language access – not Call Interface).
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
- 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'.
access logic (sequenced calls) and the data per se'.
VSAM Application Program
VSAM Application Program
…
…
Suppliers OPEN input SUPPLIER-FILE
Suppliers OPEN input SUPPLIER-FILE
if SUPPLIER-STATUS = '00'
if SUPPLIER-STATUS = '00'
subtract APPL-RESULT from
subtract APPL-RESULT from
Secondary APPL-RESULT
Secondary APPL-RESULT
Index File else add 12 to ZERO giving
Index File else add 12 to ZERO giving
Supplier APPL-RESULT end-if
Supplier APPL-RESULT end-if
Zip Codes …
Zip Codes …
22
Files and Databases – Other
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== ====================================================
======== ====================================================
====================
====================
QSAM Queued Sequential Access Management (aka "flat" files). Sequential
QSAM Queued Sequential Access Management (aka "flat" files). Sequential
files…
files…
Non-indexed files that hold (almost always) batch data for bulk processing. Often historical data,
Non-indexed files that hold (almost always) batch data for bulk processing. Often historical data,
back-ups and image-copy data.
back-ups and image-copy data.
23
Traditional Development Environment
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== ====================================================
======== ====================================================
====================
====================
TSO Time Sharing Option. Basically, a "job" that runs under z/OS responsible UNIX/Windows
TSO Time Sharing Option. Basically, a "job" that runs under z/OS responsible UNIX/Windows
O.S.
O.S.
for managing program development resources (files, Login, jobs, etc.)
for managing program development resources (files, Login, jobs, etc.)
ISPF Interactive Systems Programming Facility. Each individual developer's custom RDz
ISPF Interactive Systems Programming Facility. Each individual developer's custom RDz
Development IDE, that allows programmers to: Create new source files and manage them.
Development IDE, that allows programmers to: Create new source files and manage them.
- Edit source and data files, interact with common version control software,
- Edit source and data files, interact with common version control software,
compile/link/run/test programs (usually by submitting background "jobs")
compile/link/run/test programs (usually by submitting background "jobs")
through JCL – but often shops provide "foreground" (interactive) facilities for this common process.
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.
- 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
- 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
standards, raising productivity, and providing easier access to in-house functions – often written
in REXX or CLIST language.
in REXX or CLIST language.
- Sometimes called: SPF (for short). C.A. offers a similar facility, named: ROSCOE.
- Sometimes called: SPF (for short). C.A. offers a similar facility, named: ROSCOE.
Version Many different competing version control and "library management" facilities
Version Many different competing version control and "library management" facilities
ClearCase
ClearCase
Control Available on the mainframe. They all do (roughly) the same thing. Most shops use:
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
Software CA-Endevor, Serena-Changeman, IBM-SCLM, CA-Panvalet, CA-Librarian
24
Terms and Concepts – TSO/ISPF Development
ISPF "Main Menu" of
ISPF "Main Menu" of
development options
development options
ISPF
ISPF
Utility
Utility
Allocate
Allocate
Dataset
Dataset
(file)
(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
26
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
27
Programming Languages
Mainframe Description Network/PC Equivalent
Mainframe Description Network/PC Equivalent
======== ====================================================
======== ====================================================
====================
====================
COBOL Common Business Oriented Language
COBOL Common Business Oriented Language
BASIC
BASIC
- A 50+ year-old language, that is still being heavily invested in – although not nearly at
- 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
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.
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.
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
- COBOL programs have a DATA DIVISION – analogous to a class's attributes, and a
PROCEDURE DIVISION – analogous to a class's methods.
PROCEDURE DIVISION – analogous to a class's methods.
- Data structures and files are defined through what are called copybooks – which describe the
- 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
individual fields and field definitions (data format, etc.). Copybooks are downloaded and become
RRD classes, when accessed through our mainframe integration technology.
RRD classes, when accessed through our mainframe integration technology.
HLASM High Level Assembler Assembler
HLASM High Level Assembler Assembler
High Level Assembler is an IBM licensed program that helps you develop programs
High Level Assembler is an IBM licensed program that helps you develop programs
and subroutines to provide functions not typically provided by other symbolic
and subroutines to provide functions not typically provided by other symbolic
languages, such as COBOL, FORTRAN, and PL/I.
languages, such as COBOL, FORTRAN, and PL/I.
PL/I An elegant, 3rd rdgeneration, imperative, structured programming language.
PL/I An elegant, 3 generation, imperative, structured programming language.
BASIC
BASIC
Used a lot in scientific and financial shops. Not as universal as COBOL.
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
RPG Report Program Generator. A high-level 3GL
28 – used extensively on the Power i
Software – Programming Languages – "Hello World" Comparison
000100 IDENTIFICATION DIVISION. HELLOPRT START 0 IN THE BEGINNING...
000100 IDENTIFICATION DIVISION. HELLOPRTPRINT
STARTNOGEN
0 IN THE
SPARE US BEGINNING...
THE MACRO EXPANSIONS
000200 PROGRAM-ID. HELLOWORLD.
000200 PROGRAM-ID. HELLOWORLD. BEGIN PRINT(14,12)
SAVE NOGEN SPARE
SAVE US THE
INPUT MACRO EXPANSIONS
REGISTERS
000300* BEGIN
000300* LRSAVE 12,15
(14,12) SAVE ARE
WHERE INPUTWE?REGISTERS
000400 ENVIRONMENT DIVISION. LR
USING 12,15
HELLOPRT,12 WHEREHERE
RIGHT ARE WE?
000400 ENVIRONMENT DIVISION.
000500 CONFIGURATION SECTION. STUSING13,SAVE+4
HELLOPRT,12 RIGHT
SAVE OLDHERE
SAVE AREA ADDRESS
000500 CONFIGURATION SECTION.
000600 SOURCE-COMPUTER. IBM-COBOL. LAST 13,SAVE+4
11,SAVE SAVE TO
POINT OLDNEW
SAVE AREA
SAVE ADDRESS
AREA
000600 SOURCE-COMPUTER. IBM-COBOL. STLA 11,SAVE
11,8(13) INPOINT TO NEW
OLD SAVE SAVE AREA
AREA
000700 OBJECT-COMPUTER. IBM-COBOL.
000700 OBJECT-COMPUTER. IBM-COBOL. LRST 11,8(13)
13,11 IN OLD
MOVE SAVESAVE
AREAAREA
ADDRESS
000800 LR 13,11 MOVE SAVE AREA ADDRESS
000800 *
000900 DATA DIVISION. * *WRITE "HELLO, WORLD!" ON WHATEVER HAS BEEN SET UP AS SYSPRINT
000900 DATA DIVISION.
001000 FILE SECTION. IN* WRITE "HELLO, WORLD!" ON WHATEVER HAS BEEN SET UP AS SYSPRINT
001000 FILE SECTION.
001100 * INTHE INVOKING JCL (NO, UNIX DOESN'T HAVE A MONOPOLY ON DEVICE-
001100
001200 PROCEDURE DIVISION. * * INDEPENDENT
THE INVOKING JCL (NO, UNIX DOESN'T HAVE A MONOPOLY ON DEVICE-
I/O!)
001200 PROCEDURE DIVISION. * * INDEPENDENT I/O!)
001300 DISPLAY "Hello world!". *
001300 DISPLAY "Hello world!". DOPUT EQU *
001400 STOP RUN. DOPUT EQU SYSPRINT,HELLOMSG
PUT * WRITE THE MESSAGE
001400 STOP RUN.
B PUT DOPUT
SYSPRINT,HELLOMSG FOREVER...
WRITE THE MESSAGE
COBOL program * B DOPUT FOREVER...
COBOL program * *THIS CODE WILL NEVER BE REACHED, BUT IS INCLUDED FOR
* THIS CODE WILL NEVER BE REACHED, BUT IS INCLUDED FOR
COMPLETENESS
* COMPLETENESS
* L 13,SAVE+4 GET OLD SAVE AREA BACK
L
RETURN 13,SAVE+4
(14,12),RC=0 TOGET
THEOLD SAVE AREA
OPERATING BACK
SYSTEM
* RETURN (14,12),RC=0 TO THE OPERATING SYSTEM
* *FILE AND WORK AREA DEFINITIONS
* * FILE AND WORK AREA DEFINITIONS
HELLO: PROCEDURE OPTIONS (MAIN); *
SAVE DS 18F LOCAL SAVE AREA
HELLO: PROCEDURE OPTIONS (MAIN); SAVE
HELLOMSG DCDS C'18FHELLO, WORLD!' LOCAL SAVE AREA
/* A PROGRAM TO OUTPUT HELLO WORLD */ HELLOMSG DC C' HELLO, WORLD!'
/* A PROGRAM TO OUTPUT HELLO WORLD */ SYSPRINT DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,
FLAG = 0; LOOP: SYSPRINT
X DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,
FLAG = 0; LOOP: X RECFM=FA,LRECL=133,BLKSIZE=133
DO WHILE (FLAG = 0); RECFM=FA,LRECL=133,BLKSIZE=133
DO WHILE (FLAG = 0); END BEGIN HLASM program
PUT SKIP DATA('HELLO WORLD!'); END BEGIN HLASM program
PUT SKIP DATA('HELLO WORLD!');
END LOOP;
END LOOP;
END HELLO; PL/I program
END HELLO; PL/I 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
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,…
J LOADLIB
//JOB JOBNAME=MYJOB,…
E z/OS Compiled
Programs
JCL S
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…
C LOADLIB
TRANCODE I z/OS Compiled
Online
C
Programs
S
33
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")
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:
C I
I M
TRANCODE
C S z/OS
S
T
M
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