ca idms modernization series, part 2: table procedures and ca idms sql quick bridge august 5, 2008...

62
CA IDMS™ Modernization Series, part 2: Table Procedures and CA IDMS™ SQL Quick Bridge August 5, 2008 Cal J. Domingue

Upload: katherine-clay

Post on 26-Mar-2015

272 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

CA IDMS™ Modernization Series, part 2: Table Procedures and CA IDMS™ SQL Quick Bridge

August 5, 2008

Cal J. Domingue

Page 2: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

2 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Legal

This presentation was based on current information and resource allocations as of August 5, 2008 and is subject to change or withdrawal by CA at any time without notice. Notwithstanding anything in this presentation to the contrary, this presentation shall not serve to (i) affect the rights and/or obligations of CA or its licensees under any existing or future written license agreement or services agreement relating to any CA software product; or (ii) amend any product documentation or specifications for any CA software product. The development, release and timing of any features or functionality described in this presentation remain at CA’s sole discretion. Notwithstanding anything in this presentation to the contrary, upon the general availability of any future CA product release referenced in this presentation, CA will make such release available (i) for sale to new licensees of such product; and (ii) to existing licensees of such product on a when and if-available basis as part of CA maintenance and support, and in the form of a regularly scheduled major product release. Such releases may be made available to current licensees of such product who are current subscribers to CA maintenance and support on a when and if-available basis.  In the event of a conflict between the terms of this paragraph and any other information contained in this presentation, the terms of this paragraph shall govern.

Page 3: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

3 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Legal

Certain information in this presentation may outline CA’s general product direction. All information in this presentation is for your informational purposes only and may not be incorporated into any contract. CA assumes no responsibility for the accuracy or completeness of the information. To the extent permitted by applicable law, CA provides this document “as is” without warranty of any kind, including without limitation, any implied warranties or merchantability, fitness for a particular purpose, or non-infringement. In no event will CA be liable for any loss or damage, direct or indirect, from the use of this document, including, without limitation, lost profits, lost investment, business interruption, goodwill, or lost data, even if CA is expressly advised of the possibility of such damages.

Page 4: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

4 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Abstract

> CA IDMSTM SQL allows you to access CA IDMSTM databases directly with SQL DML, regardless of whether the databases were originally defined as SQL or network data. For certain database structures or application needs, utilizing routines may make your implementation more efficient and robust; in rare cases they may be required. Part 1 of this 3-part series covered an overview of routines: table procedures, procedures, called procedures, and functions. The series continues in this webcast by exploring table procedures in depth, with details on how to design, code, and deploy them. It will also address how to use CA IDMSTM SQL Quick Bridge to create table procedures, including a live demo of the product.  

Page 5: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

5 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Agenda

> Business Value of CA IDMS Modernization and SOA

> SQL routines Review

How table procedures compare to other routines

> Table procedures: structure and coding

> Table procedures: run-time

> CA IDMSTM SQL Quick Bridge

> Session Summary

Page 6: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

Business Value of

CA IDMS Modernization and SOA

Page 7: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

7 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

CA IDMS Business Value:Modernization and SOA

> Access CA IDMS mainframe assets

Databases and business logic

Enable Web access, Web services, SOA participation

> Use standard APIs with CA IDMS SQL, CA IDMS Server

SQL, JDBC, ODBC, .NET, Web services …

Partner solutions

> Provide business value benefits

Use current developer skills

Preserve existing data and applications

Deploy on modern platforms: J2EE, .NET

Tie CA IDMS assets into modern enterprise architecture

Page 8: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

8 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

SOA

Web and Application Servers

Modern Application Architecture

Internet

CA IDMS™Server

CA IDMS data and business logic

Web Applications

Page 9: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

SQL Routines: Review

How Table Procedures Compare To Other Routines

Page 10: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

10 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

What is a Routine?

Think PIP

A routine is a user-written Program or dialog which is Invoked directly by the SQL engine when the routine is referenced in SQL DML; the call is managed by PParameters specified either as part of the definition or as part of a standard set of arguments included in the call.

Implications Involves user-written code, must be tested and optimized Code must be written to interface successfully with engine Parameter values have great impact

Page 11: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

11 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

CA IDMS Routines

> Invoked by SQL engine when referenced in SQL DML Definition specifies external routine name

Parameters passed and returned

Routine performs I/O and/or processing

Possible iterations for table procedure

> Three types of SQL routines Table procedure

Procedure

Function

Page 12: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

12 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Types of Routines

Type Invoked via reference

#Rows Returned

#Rows Updated

ADS?

SQL Proc Code

Table Procedure

Datasource in SQL DML

0-many; controlled by code

0-many; controlled by code

No No

Procedure Datasource in SQL DML, Call

0-1 0-many OK SQL procedure

Function Expression in SQL DML

n/a: value n/a OK SQL function

Page 13: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

13 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

When To Use Table Procedures?

Value or

Row(s)?

SQLFunction

MultipleRows

?

Use SQLCode

?

Table Procedure

SQLProcedure

Called Procedure

Rows No No

Yes Yes

Use SQLCode

?

Yes

CalledFunction

No

Value

Page 14: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

14 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

When to Use Table Procedures

> When SQL access to data is required

> When direct SQL DML access does not meet needs

> When views do not meet needs to simplify complex SQL DML

> Analyze performance requirements Highly variable cardinality and statistics Sophisticated security, i.e. row level, external dependencies Reduce client/server communication

> To standardize common complex processes

> Not required for SQL access to some network structures Fixed occurs elements Update/Delete rows where no foreign key defined (ROWID)

Page 15: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

15 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

When to Use Table Procedures (cont.)

> Required for SQL access to some network database structures

Bill of Material

Occurs depending on elements

Multi-member sets

Insert rows in sets and no foreign keys defined

Structures requiring special, complex processing (REDEFINES)

Within a single SQL transaction

– Transparently consolidate data from different databases

– Access segmented databases

Access remote data (distributed across nodes)

Page 16: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

Table Procedures

Structure and Coding

Page 17: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

17 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Implement Table Procedure: CrEATE

>Create statement: define table procedure in catalog

>Write the routine COBOL, Assembler, PL/I SQL DML, network DML, neither, or both Must create access module if using SQL DML

>Enable security

>Add program definition to system (DC/UCF)

>Test and debug

>Efficiency check: optimize & tune

Page 18: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

18 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Create Statement: Define In The Catalog

> Schema and name

> External name: associates table procedure with load module

> Parameters: Name, SQL data type, optional default

> Language: Assembler, COBOL, PL/I

> Protocol IDMS

> Local and global work areas

> Default database current

> Other attributes: estimates, system/user mode, etc.

Page 19: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

19 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Create Table Procedure: Example

CREATE TABLE PROCEDURE DEMOEMPL.TBLPROC

( E_ID UNSIGNED NUMERIC(4),

E_NAME CHARACTER(25),

E_ADDRESS CHARACTER(46) )

EXTERNAL NAME TPROCPGM

ESTIMATED ROWS 1000

ESTIMATED IOS 100

USER MODE

LOCAL WORK AREA 800

GLOBAL WORK AREA 1200 KEY SHR1

TRANSACTION SHARING DEFAULT

DEFAULT DATABASE CURRENT

TIMESTAMP ;

Page 20: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

20 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Create: Options on r16 & higher

> Default database option Enables database name inheritance

Procedure inherits dbname of session

> Transaction sharing option Can share session locks

Eliminates deadlocks

> Synchronization timestamp Defaults to current day/time

Migrating to another environment

Force recompilation of access modules

Force renewal of statements in cache

Page 21: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

21 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Write The Table Procedure

> CA IDMSTM SQL Quick Bridge Generates COBOL source, SQL DDL, Sysgen Program COBOL code can be modified if necessary

> Interface successfully with SQL engine Highly structured code and storage layout

> Parameter-driven (input and output) One for each parameter specified in the definition One null indicator for each parameter in the definition Common arguments Language-specific description must match SQL data type

> COBOL protocol BATCH for maximum portability

> Existing code possible to include within structured code

Page 22: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

22 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Write The Table Procedure (cont.)

> Storage layout essential to communicate with SQL engine

> Code must test input parameters Perform appropriate code based on values Determine flow of control within sections

> Code must set output parameters SQLSTATE is required, controls when iteration is stopped

– 00000 -- Indicates success 

– 01Hxx -- Indicates a warning

– 02000 -- Indicates no more rows

– 38xxx -- Indicates an error

Values, indicators (0, -1) required to return row Customized error messages optional

Page 23: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

23 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Write The Table Procedure: Work Areas

> Linkage Section in COBOL

> Local work area – can’t exceed size in definition Separate area for each scan

Preserved over calls within scan (DML)

Database position, input parameters, etc

> Global work area– can’t exceed size in definition Shared by procedures and scans in transaction

Subschema control

Has an associated key

Page 24: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

24 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Write The Table Procedure: Work Areas

> COBOL working storage contents not retained across calls

> Values on first request for a scan might have been altered in prior request

> Working-storage section allocation and initialization varies Local mode vs. within the DC/UCF address space

Concurrent scans are being processed

> Use working storage only for: Constants the SQL routine will never change

Variables initialized and used within single call to program

> Other variables must be defined in local or global work area

Page 25: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

25 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Write: Common Arguments

77 RESULT-IND PIC S9(4) USAGE COMP SYNC.

01 SQLSTATE. 02 SQLSTATE-CLASS PIC XX. 02 SQLSTATE-SUBCLASS PIC XXX. 77 PROCEDURE-NAME PIC X(18). 77 SPECIFIC-NAME PIC X(8). 77 MESSAGE-TEXT PIC X(80). 01 SQL-COMMAND-CODE PIC S9(8) USAGE COMP

SYNC. 01 SQL-OP-CODE PIC S9(8) USAGE COMP

SYNC. 88 SQL-OPEN-SCAN VALUE +12. 88 SQL-NEXT-ROW VALUE +16. 88 SQL-CLOSE-SCAN VALUE +20. 88 SQL-SUSPEND-SCAN VALUE +24. 88 SQL-RESUME-SCAN VALUE +28. 88 SQL-INSERT-ROW VALUE +32. 88 SQL-DELETE-ROW VALUE +36. 88 SQL-UPDATE-ROW VALUE +40. 01 INSTANCE-ID PIC S9(8) USAGE COMP

SYNC.

Page 26: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

Copyright ©2006 CA. All rights reserved. All trademarks, trade names, services marks and logos referenced herein belong to their respective companies.26

Write: Linkage Section Example LINKAGE SECTION. 77 E-ID PIC 9(4). 77 E-NAME PIC X(25). 77 E-ADDRESS PIC X(46). 77 E-ID-I PIC S9(4) COMP SYNC. 77 E-NAME-I PIC S9(4) COMP SYNC. 77 E-ADDRESS-I PIC S9(4) COMP SYNC. 77 RESULT-IND PIC S9(4) COMP SYNC. 77 SQLSTATE PIC X(5). 77 PROCEDURE-NAME PIC X(18). 77 SPECIFIC-NAME PIC X(8). 77 MESSAGE-TEXT PIC X(80). 01 SQL-COMMAND-CODE PIC S9(8) COMP SYNC. 01 SQL-OP-CODE PIC S9(8) COMP SYNC. 88 OPEN-SCAN VALUE +12. 88 NEXT-ROW VALUE +16. 88 CLOSE-SCAN VALUE +20. 88 SUSPEND-SCAN VALUE +24. 88 RESUME-SCAN VALUE +28. 01 INSTANCE-ID PIC S9(8) COMP SYNC. 01 LOCAL-WORK-AREA. 02 NEXT-ROW-FLAG PIC X. 88 GET-NEXT-ROW VALUE '1'. 02 ACCESS-FLAG PIC X.

88 GET-CALC VALUE '1'. 88 CALC-DONE VALUE '2'.

02 WK-EMP-ID PIC 9(4). 01 GLOBAL-WORK-AREA. 02 COPY IDMS SUBSCHEMA-CTRL. 02 COPY IDMS SUBSCHEMA-CTRL. 02 COPY IDMS RECORD EMPLOYEE. 02 COPY IDMS RECORD DEPARTMENT. 02 COPY IDMS RECORD OFFICE.

Parameters and null indicators

Common Arguments

Global Work Area

Local Work Area

Page 27: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

27 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Enable Security

> Security identical to a table Grant and revoke

SELECT, INSERT, UPDATE, DELETE, DEFINE privileges

To create

– Own the schema in which the table procedure is

– Hold the CREATE privilege on table procedure

To invoke, either own or hold privilege for verb

Page 28: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

28 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Add Program Definition to System

> Required when executing in CA IDMS Central Version

> Example

ADD PROGRAM CAAVLREC

DUMP THRESHOLD IS 0

ERROR THRESHOLD IS 5

ISA SIZE IS 0

LANGUAGE IS COBOL .

> Before sysgen cycle, use dynamic definition for testing

DCMT VARY DYN PRO CAAVLREC COBOL .

Page 29: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

29 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Test and Debug Routines

> DISPLAY commands in COBOL, PL/I to print to file (LE/370) Automatically generated by CA IDMS SQL Quick Bridge

> Reference in local mode DML to trace path through logic SYSIDMS parameters

– DMLTRACE=ON

– SQLTRACE=ON

– PROCTRACE=ON (with either above)

“DEBUG”  COBOL statements (compile with DEBUG option)

> CV mode testing CA IDMSTM Performance Monitor or other monitor for statistics WRITE TO LOG or SNAP commands for trace, data structures DISPLAY commands to trace logic path, show values

> Evaluate logical results

Page 30: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

30 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Efficiency: Statistics and Optimization

> Code efficiency only concern if routine is sole data source

> Statistics provided manually (only) Table procedure definition, key definition

ESTIMATED ROWS

ESTIMATED IOS

Lower values encourage execution of table procedure first

> Very useful in joins with other data sources

> Verify access path with EXPLAIN

> Test thoroughly

> Document extensively

Page 31: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

31 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Efficiency: Keys

> Define with CREATE KEY statement> Specifying key columns

KEY estimated values override routine values if all KEY elements specified

Influences join strategy Statistics for KEY used in optimization Using a key in join operations

– Specify in “WHERE” clause– Encourage use by specifying low value for statistics

CREATE KEY EMP1 ON DEMOEMPL.TBLPROC(E_ID)

ESTIMATED ROWS 1 ESTIMATED IOS 1;

Page 32: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

Table Procedures

Run-Time

Page 33: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

33 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Invoking a Table Procedure

> SQL DML statements Reference in FROM, like view or table Use in any DML statement

> Program DML independent of SQL DML

> Parameter values passed dependent on type of DML

> Possible to use a CALL statement For CA IDMSTM Server 5.0, from JDBC procedure call For CA IDMSTM Server r16, from ODBC procedure call

> “Where” filters output from table procedure Not required; no “where” returns all occurrences

Page 34: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

34 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Table Procedure

> Called iteratively, returns 0 to many rows Invoked repetitively

Must return SQLSTATE=02000 or 38nnn to stop invocations

Next call determined based on SQLSTATE of previous call

Results rows determined by values returned and WHERE

> Runs as subroutine called by SQL engine Highly structured program code

Formalized Linkage Section

Matching PROCEDURE DIVISION USING

Page 35: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

35 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Interpret Parameters: Command Code

> First thing to check in the program code

> SQL-OP-CODE element in common arguments

> Indicates type of SQL DML for which the call is issued SELECT

FETCH

INSERT

Etc.

> Based on value, code must perform appropriate sections

Page 36: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

36 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Interpret Parameters: Operation Code

> Queries: Open, Next Row, Close operation codes

> Open Allocate resources

Retrieve the values of input parameters

Perform processing needed to get ready to retrieve the rows

> Next Row Retrieve and return the database row

> Close Release resources

Page 37: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

37 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Translating DML to Table Procedure Calls

SQL DML Open Scan

Next Row

Delete Row

Update Row

Close Scan

Insert Row

Suspend Scan

Resume Scan

SELECT X 2, 3… XDelete Search

X 2a,3a…

2b,3b…

X

UPDATE Searched

X 2a,3a…

2b,3b…

X

DELETE Positioned

X

UPDATE Positioned

X

OPEN XFETCH XCLOSE XINSERT XSUSPEND XRESUME X

Page 38: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

38 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Explicit Parameters

> Used to pass values to table procedure

> Specify via table procedure reference By position

Keyword/value pairs

> Specify in a WHERE clause, passed if They are part of an equality test

Equality test is not combined with OR

Equality test not preceded by NOT

> “Where” filters output from table procedure

SELECT * FROM EMP.ORG (MGR_ID = 7) WHERE EMP_ID = 127

Page 39: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

39 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Explicit Parameters Passed by Operation

> Open Selection criteria from WHERE Parameter values in procedure reference Default value if WITH DEFAULT specified in definition

> Update row Previous “Next Row” values Overlaid with SET value

> Insert row From VALUES of INSERT or SELECT Defaults or nulls

> Other calls Undefined input

Page 40: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

40 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Explicit Parameters To Return

> From table procedure to SQL engine

> Always return a value for SQLSTATE Required to determine subsequent call

02000 or 38000 required to terminate processing

> If operation code is NEXT ROW Provide values for all parameters

Set indicator variables to -1 if no value

> Optional 80-byte message area (embedded in standard DB message)

Page 41: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

41 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

SQLSTATE

Value Description SQL Engine Action

00000 Request was Next call (see chart); orsuccessful return to application

01Hxx Success with Next call (see chart); or warning return to application

02000 No more rows to Close call; or be returned return to application

38xxx Procedure Rollback any changes and detected an error return to application

Page 42: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

42 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

TBLPROC Example

SELECT * FROM DEMOEMPL.TBLPROC WHERE E_ID = 371;

Page 43: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

43 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

TBLPROC Example (cont.)

SQL Engine TBLPROC

E_ID = 371E_ID_I = 0Command=SELECTOperation=OPEN

Check OperationCall OPEN SectionBind RUBind EmployeeReady AreaSave E_ID if not null

SQLSTATE = 00000Evaluate SQLSTATE 00000, so NEXT

Page 44: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

44 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

TBLPROC Example (cont.)

SQL Engine TBLPROC

Command=SELECTOperation=NEXT

Check OperationCall NEXT SectionCheck CALC-DONE flagObtain CALC EmployeeSet flag CALC-DONE

E_ID = 0371E_ID_I = 0E_NAME=Beth CloudE_NAME_I = 0E_ADDRESS=3456 Pinky LnE_ADDRESS_I = 0SQLSTATE = 00000

Evaluate SQLSTATE 00000, so evaluate returned row with where clause values Then issue NEXT

Page 45: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

45 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

TBLPROC Example (cont.)

SQL Engine TBLPROC

SQLSTATE = 02000

Command=SELECTOperation=NEXT

Check Operation

Call NEXT Section Check CALC-DONEReturn no more rows

Evaluate SQLSTATE 02000, so CLOSE

Page 46: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

46 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

TBLPROC Example (cont.)

SQL Engine TBLPROC

SQLSTATE = 00000

Command=SELECTOperation=CLOSE

Check OperationCall CLOSE Section FINISH

Evaluate SQLSTATE 0000, so return to application

Page 47: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

CA IDMSTM SQL Quick Bridge

Function and Use

Page 48: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

48 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

SQL Quick Bridge: QO93444

> GUI front-end

> Uses existing ODBC data source definitions

> Pull-down menus

> Structured approach to walk network structure Specify schema, subschema

Walk record from top to bottom in network structure

Specify desired records, key fields, target elements

> Generates definition, sysgen program statement and COBOL program

> Can upload all components to CV

Page 49: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

49 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Connect to Data Source

Page 50: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

50 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Define New Table Procedure:- SQL schema, name, external name- Specify network schema & subschema- Specify supported DML statements

Page 51: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

51 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Entry Point- Calc or index record- Specify calckey or sortkey

Page 52: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

52 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Path Records- Drill down using sets- Identify key fields for each record

Page 53: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

53 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Identify Target Record- Identify desired fields- Auxiliary records as desired

Page 54: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

54 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Generate Then Upload

Page 55: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

55 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Live Demo

Page 56: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

Summary

Page 57: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

57 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Session Summary

> Use table procedures When SQL access is required

When direct SQL DML access doesn’t meet needs

To access certain network database structures

For some performance reasons

> Table Procedures CrEATE: follow the steps

Return multiple rows from a single call

Are highly structured in storage layout and code

Must interpret parms to direct flow of control

Must set value for SQLSTATE on every call

Page 58: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

58 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

Session Summary (cont.)

> SQL Quick Bridge GUI front-end for developing Table Procedures

Walks network CA IDMS database

Entry record: chose Calc or Indexed record

Path records: top-down hierarchical structure

Target record: lowest in hierarchy

Auxiliary records

Generate & upload

> Test and verify results

Page 59: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

59 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

For More Information

> Recorded Webcast: http://ca.com/us/webcasts/ondemand/default.aspx CA IDMSTM Modernization: Overview of CA IDMSTM SQL Routines CA IDMSTM Modernization: CA IDMSTM Procedures, Advanced Topics

> support.ca.com CA IDMS knowledge documents Product manuals

– CA IDMS SQL Reference Guide– CA IDMS r17 Release Summary (available at GA)

Technical support

> Analyst white paper on CA IDMS modernization and SOA Leveraging CA IDMS™ Business Value for Innovation See ca.com/idms under Analyst Reports

Page 60: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

60 August 5, 2008 CA IDMS™ Modernization Series:Table Procedures and CA IDMS™ SQL QuickBridge Copyright © 2008 CA

CA WORLD 2008: November 16th – 20th

The Venetian Congress Center and Sands Expo, Las Vegas

> The biggest Mainframe ISV Event in the world in 2008!

> CA IDMS sessions in Mainframe and Multi-Platform Application Development Focus Area

Customer, Partner and CA speakers

Optimization, Modernization, SOA and r17 sessions

> Pre-conference Education EC802EN CA IDMS: Implementing and Maintaining the Database

EC801EN CA IDMS Performance and Tuning

> Networking Opportunities Technical Campground, Birds-of-a-Feather session,

Exhibition Center, Power lunches

> Visit www.caworld.com for more details

Page 61: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

Questions & Answers

Page 62: CA IDMS Modernization Series, part 2: Table Procedures and CA IDMS SQL Quick Bridge August 5, 2008 Cal J. Domingue

Thank You for

Attending Today’s Webcast