Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications...

23
Remote Stored Procedures

description

From the Application Perspective... Data returned from an RSP is no different than data returned from a relational DBMS!

Transcript of Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications...

Page 1: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Remote Stored Procedures

Page 2: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Remote Stored Procedures

Customer-written CICS application programs Provides LAN applications with access to CICS resources Invoked by LAN-based client or web application Invoked with USE or EXECUTE statement

Page 3: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

From the Application Perspective . . .

Data returned from an RSP is no different than Data returned from an RSP is no different than data returned from a relational DBMS!data returned from a relational DBMS!

Page 4: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Stored Procedure Processing

Access Server

CICS

USE PROCEDURE PAYHISTUSE PROCEDURE PAYHISToror

EXECUTE PAYHISTEXECUTE PAYHIST

RSP

Page 5: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Why Use Remote Stored Procedures? Programmatic access to S/390 data and resources Access unusual data sources or difficult data structures Perform complex processing Execute existing business logic

Page 6: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Typical Uses for RSPs

Desktop and web access to non-relational data– VSAM– IMS and DL/I– Datacom, Adabas, IDMS– Others

Static access to DB2 Invocation of other CICS programs Access to other CICS resources ViaSQL TRANSFER operations

Page 7: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Modernize Existing CICS Applications Preserve investment in existing business logic and applications Just strip out the 3270 screen interactions Add the appropriate RSP commands Execute from desktop or web applications

Page 8: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Integrate 4GL Applications

Desktop and web access to S/390-based 4GL applications Ideal for access to Datacom/DB Natural for access to Adabas

Page 9: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Stored Procedure Programs

Customer written Standard CICS application program Supported languages

– COBOL II– Assembler– PL/I– C

Page 10: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Stored Procedure API

Easy to use CICS application issues Stored Procedure commands Issued via standard system CALL Stored Procedure Communication Area Stub routines

Page 11: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Stored Procedure Commands

STATUS indicate outcome of processing MESSAGE send a message to the workstation DESCRIBE obtain column information about a table COMMIT commit work ROLLBACK rollback work OPENPIPE open a data pipe GETPIPE read a record from the data pipe PUTPIPE write a record to the data pipe CLOSPIPE close the data pipe

Page 12: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Sample Stored ProcedureENVIRONMENT DIVISION.PROGRAM ID. PROGRAM3.*********************************************************************** INSERT A ROW INTO THE DB2 EMPLOYEE MASTER TABLE ***********************************************************************..

DATA DIVISION.01 EMPLOYEE-RECORD.

03 SSNO PIC X(11).03 NAME.

05 NAME-LEN PIC S9(4) COMP.05 NAME-TEXT PIC X(30).

03 HIREDATE PIC X(10).03 EXEMPTS PIC S9(4) COMP.03 WAGE PIC S999V99 COMP-3.

LINKAGE SECTION.01 DFHCOMMAREA.

COPY SPAREAC.

Page 13: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Sample Stored Procedure - continued

PROCEDURE-DIVISION.MOVE '522-80-3109' TO SSNO.MOVE 30 TO NAME-LEN.MOVE 'GROUCHO MARX' TO NAME-TEXT.MOVE '1988-03-27' TO HIREDATEMOVE 3 TO EXEMPTS.MOVE 12.25 TO WAGE.PERFORM -INSERT-EMPLOYEE.IF SQLCODE = 0 THEN PERFORM ISSUE-OK ELSE PERFORM ISSUE-ERROR.EXEC CICS RETURN.

INSERT-EMPLOYEE.EXEC SQL INSERT INTO Z271.SAMPLE_EMPLOYEE

(SSNO, NAME, HIRE_DATE, EXEMPTIONS, HOURLY_WAGE) VALUES(:SSNO, :NAME, :HIREDATE, :EXEMPTS, :WAGE)

ISSUE-OK.MOVE 'OK' TO SPSTATUS.CALL 'STATUS' USING SPAREA.

ISSUE-ERROR. MOVE 'E ' TO SPSTATUS. CALL 'STATUS' USING SPAREA.

Page 14: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Output Pipes

Used to return multiple rows of data Pipe must be open before use Pipe must be closed after use The PUTPIPE command is used to write data STD and DB2 format output pipes Access Server returns records in IXF format

Page 15: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

STD Format Output Pipe

Stored procedure need not describe the data Stored procedure supplies data in free-form No data structure in IXF file

Page 16: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

DB2 Format Output Pipe

Stored procedure describes data with SQLDA Stored procedure supplies data in DB2 format Data structure in captured in IXF file

Page 17: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Input Pipes

Used to read multiple rows of data Pipe must be opened before use Pipe must be closed after use GETPIPE command used to read records STD and DB2 format input pipes Server expects records in IXF format

Page 18: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

The DB2 SQLDA Structure

Used with dynamic SQL SELECT statements Partially filled in when DESCRIBE is executed Describes the columns to be returned by a SELECT statement User must supply pointers to data and null indicators

Page 19: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

SQLDA Structure

SQLTYPESQLTYPE SQLLENSQLLEN SQLDATASQLDATA SQLINDSQLIND SQLNAMESQLNAME

SQLDAIDSQLDAID

SQLDABCSQLDABC SQLNSQLN SQLDSQLD

Column 1 informationColumn 1 information

Column 2 informationColumn 2 information

Column 3 informationColumn 3 information

Page 20: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

The ViaSQL SQLDA Structure

Same format as the DB2 SQLDA Partially filled in when DESCRIBE is executed Describes the columns to be processed by an RSP User must supply pointers to data and null indicators

Page 21: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

DESCRIBE Processing

Makes RSP development easier The Legacy Data Manager is used to create a Virtual Table

definition At execution time, the RSP issues DESCRIBE command to fill in

the SQLDA

Page 22: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

Stored Procedure Test Facility

Provides standalone test of RSP Invoked via CICS SPTEST command User specifies stored procedure name Variables can be specified Data and messages are displayed

Page 23: Remote Stored Procedures. n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based.

More Information

Remote Stored Procedure Programmers Guide and Reference Sample RSPs on our website Sample RSPs distributed with ViaSQL software