Download presentation
Presentation is loading. Please wait.
Published byJohn Lenard Daniel Modified over 9 years ago
1
Remote Stored Procedures
2
n Customer-written CICS application programs n Provides LAN applications with access to CICS resources n Invoked by LAN-based client or web application n Invoked with USE or EXECUTE statement
3
From the Application Perspective... Data returned from an RSP is no different than data returned from a relational DBMS!
4
Stored Procedure Processing Access Server CICS USE PROCEDURE PAYHIST or EXECUTE PAYHIST RSP
5
Why Use Remote Stored Procedures? n Programmatic access to S/390 data and resources n Access unusual data sources or difficult data structures n Perform complex processing n Execute existing business logic
6
Typical Uses for RSPs n Desktop and web access to non-relational data –VSAM –IMS and DL/I –Datacom, Adabas, IDMS –Others n Static access to DB2 n Invocation of other CICS programs n Access to other CICS resources n ViaSQL TRANSFER operations
7
Modernize Existing CICS Applications n Preserve investment in existing business logic and applications n Just strip out the 3270 screen interactions n Add the appropriate RSP commands n Execute from desktop or web applications
8
Integrate 4GL Applications n Desktop and web access to S/390-based 4GL applications n Ideal for access to Datacom/DB n Natural for access to Adabas
9
Stored Procedure Programs n Customer written n Standard CICS application program n Supported languages –COBOL II –Assembler –PL/I –C
10
Stored Procedure API n Easy to use n CICS application issues Stored Procedure commands n Issued via standard system CALL n Stored Procedure Communication Area n Stub routines
11
Stored Procedure Commands n STATUSindicate outcome of processing n MESSAGEsend a message to the workstation n DESCRIBEobtain column information about a table n COMMITcommit work n ROLLBACKrollback work n OPENPIPEopen a data pipe n GETPIPEread a record from the data pipe n PUTPIPEwrite a record to the data pipe n CLOSPIPEclose the data pipe
12
Sample Stored Procedure ENVIRONMENT DIVISION. PROGRAM ID. PROGRAM3. ********************************************************************** * INSERT A ROW INTO THE DB2 EMPLOYEE MASTER TABLE * **********************************************************************. DATA DIVISION. 01EMPLOYEE-RECORD. 03SSNO PIC X(11). 03NAME. 05 NAME-LEN PIC S9(4) COMP. 05 NAME-TEXT PIC X(30). 03HIREDATE PIC X(10). 03EXEMPTS PIC S9(4) COMP. 03WAGE PIC S999V99 COMP-3. LINKAGE SECTION. 01DFHCOMMAREA. COPY SPAREAC.
13
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 HIREDATE MOVE 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.
14
Output Pipes n Used to return multiple rows of data n Pipe must be open before use n Pipe must be closed after use n The PUTPIPE command is used to write data n STD and DB2 format output pipes n Access Server returns records in IXF format
15
STD Format Output Pipe n Stored procedure need not describe the data n Stored procedure supplies data in free-form n No data structure in IXF file
16
DB2 Format Output Pipe n Stored procedure describes data with SQLDA n Stored procedure supplies data in DB2 format n Data structure in captured in IXF file
17
Input Pipes n Used to read multiple rows of data n Pipe must be opened before use n Pipe must be closed after use n GETPIPE command used to read records n STD and DB2 format input pipes n Server expects records in IXF format
18
The DB2 SQLDA Structure n Used with dynamic SQL SELECT statements n Partially filled in when DESCRIBE is executed n Describes the columns to be returned by a SELECT statement n User must supply pointers to data and null indicators
19
SQLDA Structure SQLTYPE SQLTYPE SQLLEN SQLLEN SQLDATA SQLDATA SQLIND SQLIND SQLNAME SQLNAME SQLDAID SQLDABC SQLDABC SQLN SQLN SQLD SQLD Column 1 information Column 2 information Column 3 information
20
The ViaSQL SQLDA Structure n Same format as the DB2 SQLDA n Partially filled in when DESCRIBE is executed n Describes the columns to be processed by an RSP n User must supply pointers to data and null indicators
21
DESCRIBE Processing n Makes RSP development easier n The Legacy Data Manager is used to create a Virtual Table definition n At execution time, the RSP issues DESCRIBE command to fill in the SQLDA
22
Stored Procedure Test Facility n Provides standalone test of RSP n Invoked via CICS SPTEST command n User specifies stored procedure name n Variables can be specified n Data and messages are displayed
23
More Information n Remote Stored Procedure Programmers Guide and Reference n Sample RSPs on our website n Sample RSPs distributed with ViaSQL software
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.