Introduction to the new mainfame

38
Introduction to the new mainfame © Copyright IBM Corp., 2005. All rights reserved. Chapter 12: Databases

Transcript of Introduction to the new mainfame

Page 1: Introduction to the new mainfame

Introduction to the new mainfame

© Copyright IBM Corp., 2005. All rights reserved.

Chapter 12: Databases

Page 2: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

ObjectivesIn this chapter, you will learn:

• DB2 concepts• The DB2 system structure• DB2 for z/OS architecture• How to invoke SQL on z/OS• Application programming with DB2• Managing DB2• IMS-DB

Page 3: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Key terms in this chapter• unit of work• DBMS• SPUFI• SQLJ• SYSADM• EXPLAIN• view• modified source

Page 4: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

DB2 Concepts: Data Structures

VSAMLDS

VSAMLDS

Storage group

Data base

Table Space

Table

Index Space

Index

Views

Page 5: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Schema structures

• User-defined Data Type (UDT)• User-defined Function (UDF)• Triggers• Large Object (LOB)• Stored Procedure

Page 6: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

System Structure

Catalog and Directory: stores ALL DB2 informationBuffer PoolActive and Archive LogsBootstrap data set (BSDS)

Page 7: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

DB2 for z/OS ArchitectureDB2 Address Spaces

• System Service address space (SSAS)• Database Service address space (DBAS)• Internal Resource Lock Manager (IRLM)

DB2 Attachment Facilities• CICS• IMS• TSO

Page 8: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Invoke SQL on z/OS: SPUFI

Select option 1 to enter SPUFI

First you need to create the output file (if not existing)

Page 9: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Invoke SQL on z/OS: SPUFI (continued)

Enter the input and output dataset, if they are not yet in place.Change the member of the PDS, if you want to enter a new SQLDefaults are set to NO from YES.

Page 10: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Invoke SQL on z/OS: SPUFI (continued)

Enter the SQL statement you want to execute. Press F3 to return to the previous screen (to execute the SQL).

Page 11: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Invoke SQL on z/OS: SPUFI (continued)

When you get back to this screen, the “edit input” is put to “*”.Press ENTER to execute the SQL and to see the output.

Page 12: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Invoke SQL on z/OS: SPUFI (continued)

F8 brings the rest of the results on your screen

Page 13: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Invoke SQL on z/OS: SPUFI (continued)

Page 14: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Application Programming: the flow

SourceSourceProgramProgram

Precompile

IncludeIncludeMemberMember

Compile

Linkedit

ModifiedSource

Object Module

Load Module

DBRM

Bind

Package

Bind

Plan

DCLGEN

RUN

Page 15: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Get the access path: EXPLAIN

EXPLAIN ALL SET QUERYNO = 1SELECT EMPNO, LASTNAME

FROM EMPWHERE LASTNAME = 'MILLER';

-The query is NOT executed-The access path is placed in userid.PLAN_TABLE, if it exists

Page 16: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Other development options

• ODBC• JAVA• SQLJ• JDBC• XML• XML Column Access• XML Collection Access

Page 17: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Managing DB2: System Administration

InstallationSystem Object ManagementSystem and Disaster RecoveryMonitoring System Performance

Page 18: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Managing DB2: Database Administration

Creation and management of DB2 objectsExecution of utilities:

• Data Organization• Backup and recovery• Data Consistency

Commands

Page 19: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Functions of the IMS DM

A DBMS provides:• A single copy of data for access by multiple users • Maintenance of integrity across all updates• Minimization of HW and OS access method

dependencies• Reduction of data redundancy

Page 20: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Implementation of IMS Databases

Depending on user requirementsTechnologies :

• IMS DB or DL/I or DL1 or Full Function Database

• IMS DEDB or Data Entry DB or Fast Path Database

• IMS Main storage database (MSDB)

• IBM DB2

Database Recovery Control (DBRC)

Page 21: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Structure of IMS DB Subsystem

System Address SpaceApplication Region Address Space

Up to 99 in total

DLISeparateAddressSpace

DBRCRegion

MPP IFP BMP

ApplicationProgram

Full Function DBs RECONs

DependentRegion

AddressSpace

IMS System

IMS Libraries

IMS Message Queues

Logs

Fast Patch DBs

ControlRegion

AddressSpace

Network

JavaMessage

Processing

JavaBatch

ProcessingApplicationProgram

ApplicationProgram

Page 22: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Databases used by IMS: Database basics

Access pathsNormalization within IMS

• Unique entities• One occurrence only• No many-to-many relationships

Page 23: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Databases used by IMS: DB ModelSequence to access the segments

ROOT(1)

Segment A2(8)

Segment A1(2)

Segment D3(9)

Segment D2(4)

Segment E3(7)

Segment D1(3)

Segment E2(6)

Segment E1(5)

Segment B2(14)

Segment B1(10)

Segment G2(12)

Segment H1(13)

Segment G1(11)

Page 24: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Databases used by IMS: DB model

Additional access paths to segments• Logical relationships• Secondary indices

Page 25: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Application programming overview

Program is subroutine of IMS region controller• Needs a program specification block (PSB)• Uses services:

• Send/receive message from terminals• Access db• Issue IMS commands• Issue IMS service calls

example: Checkpoint calls, Sync call

Page 26: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Program Structure

Segments Segments to/from to/from

databasesdatabases

ENTRy

EXIT

DLI modules

Call infoCall infofrom DLIfrom DLI

PCB-Mask

IO AREA

Application Program

PROGRAM ENTRYDEFINE PCB AREASGET INPUT RECORDS FROM INPUT FILECALLS TO DL/I DB FUNCTIONS

RETRIEVEINSERTREPLACEDELETE

CHECK STATUS CODESPUT OUTPUT RECORDSTERMINATION

Page 27: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

IMS and the World Wide WebMessage flow in IMS transactions

3270 Terminal

1,2

VTAM IMS MPP

3 4,5

8,9 7 6

NCP

Page 28: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

IMS and the World Wide WebMessage flow between Web browser and Web server

Web Browser

1,2

WebServer

CGIProgram

3 4,5

8,9 7 6

TCP/IP TCP/IP

Page 29: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

IMS and the World Wide WebMessage flow IMS transaction and Web server CGI programs

3270 Terminal

1,2

VTAM IMS MPP

3 4,5

8,9 7 6

NCP

Web Browser

1,2

WebServer

CGIProgram

3 4,5

8,9 7 6

TCP/IP TCP/IP

Program to ProgramCommunications

Page 30: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

SummaryIn this chapter, you learned:

• Some DB2 concepts• The DB2 system structure• DB2 for z/OS architecture• How to invoke SQL on z/OS• Application programming with DB2• Managing DB2• IMS-DB

Page 31: Introduction to the new mainfame

Introduction to the new mainfame

© Copyright IBM Corp., 2005. All rights reserved.

Database Exercises

Page 32: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

DB2 Interactive

Page 33: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Default panel 1

Page 34: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Default panel 2

Page 35: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

DCLGEN

Page 36: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Do the exercise• Do the DCLGEN• Execute the SQL (change it if you want)• Change the program• Execute the job

Page 37: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Execute from TSO Allocate your datasets first (1)Change your parameters and press enter (2)

1

2

2

Page 38: Introduction to the new mainfame

Introduction to the new mainframe

© Copyright IBM Corp., 2005. All rights reserved.

Execute from TSO (continued): results