结合使用 CICS 和 DB2 pureXML
2010-06-24 00:00:00 来源:WEB开发网清单 2. CICS 管道配置文件
<?xml version="1.0" encoding="EBCDIC-CP-US"?>
<provider_pipeline xmlns="http://www.ibm.com/software/htp/cics/pipeline">
<service>
<terminal_handler>
<handler>
<program>WEBINST</program>
<handler_parameter_list/>
</handler>
</terminal_handler>
</service>
</provider_pipeline>
步骤 2 — 创建和安装 CICS 资源
在 CICS 区域中创建和安装以下 CICS 资源:
PIPELINE(WEBINST) CONFIGFILE(/u/user/config/insert_pipeline.xml) SHELF(/u/user/shelf)
URIMAP(WEBINST) USAGE(PIPELINE) PIPELINE(WEBINST) HOST( * ) PATH(/pureXML/insert)
PROGRAM(WEBINST) DATALOCATION(ANY)
TCPIPSERVICE(PUREXML) PORT(xxxxx) PROTOCOL(HTTP)
以下资源是 DB2 所必需的,也可跟本文场景 2 中描述的 WEBSLCT 程序共享。
DB2ENTRY(PUREXML) ACCOUNTREC(TXid) AUTHTYPE(Userid) DRollback(Yes) PLAN(PUREXML)
DB2TRAN(PUREXML) ENTRY(PUREXML) TRANSID(CPIH)
将清单 3 中所示的 COBOL 程序复制到 z/OS,并用集成的 DB2/CICS/COBOL 编译器编译它。下载 部分的样例代码包含样例编译作业。
清单 3. COBOL 程序
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. WEBINST.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
*
DATA DIVISION.
*
WORKING-STORAGE SECTION.
*
01 WSRESP PIC S9(8) COMP VALUE 0.
01 WSRESP2 PIC S9(8) COMP VALUE 0.
01 WSFLENGTH PIC S9(8) COMP VALUE 1024.
01 XMLDATA PIC X(1024) VALUE SPACES.
EXEC SQL INCLUDE SQLCA END-EXEC.
LINKAGE SECTION.
PROCEDURE DIVISION.
MAINLINE SECTION.
* Get the SOAP data
EXEC CICS GET CONTAINER('DFHREQUEST')
INTO(XMLDATA)
FLENGTH(WSFLENGTH)
RESP(WSRESP)
RESP2(WSRESP2)
END-EXEC.
EXEC SQL
INSERT INTO REDBOOK.PUREXML
( SOAP )
VALUES ( :XMLDATA )
END-EXEC
* Respond with the original XML data by deleting DFHREQUEST
* container and returning DFHRESPONSE container
EXEC CICS DELETE CONTAINER('DFHREQUEST') END-EXEC.
EXEC CICS PUT CONTAINER('DFHRESPONSE')
FROM(XMLDATA)
RESP(WSRESP)
RESP2(WSRESP2)
END-EXEC.
* Exit program
EXEC CICS RETURN END-EXEC.
MAINLINE-EXIT.
EXIT.
*----------------------------------------------------------------*
更多精彩
赞助商链接