编写定制 EP 适配器
定制 EP 适配器是与事件绑定关联的 CICS® 程序,该程序 格式化并发出 事件绑定生成的事件。
关于此任务
CICS 针对发出的每个事件调用 EP 适配器。 定制 EP 适配器的输入是当前通道,其中包含作为容器集合的 CICS 事件对象。 容器包括: DFHEP.CONTEXT, DFHEP.DESCRIPTOR, DFHEP.ADAPTER, DFHEP.ADAPTPARM, DFHEP.CHAR.nnnnn和 DFHEP.DATA.nnnnn。 提供了 DFHEP.CONTEXT、DFHEP.DESCRIPTOR 和 DFHEP.ADAPTPARM 容器的副本。 这些副本可以在 CICS发行版之间进行更改; 因此,您应该针对每个新的 CICS 发行版重新编译定制 EP 适配器。
除了发出的事件外,定制 EP 适配器还必须生成用于表明成功与否的指示。
过程
COBOL 语言的示例代码片段
此代码片段显示该过程中所述步骤的顺序。 其中不包含任何对 EP 适配器信息或数据项的处理。
******************************************************************
Linkage section.
******************************************************************
01 EPContext.
copy dfhepcxo.
01 EPDescriptor.
copy dfhepdeo.
01 EPAdapter pic x(16).
01 EPAdaptparm
copy dfhepapo.
01 EPData pic x(32000).
******************************************************************
Main-program section.
******************************************************************
*
perform Initial-processing.
*
* Process the data items
perform Process-data-item
varying ItemNum from 1 by 1
until ItemNum > epde-itemcount.
*
******************************************************************
* Any final EVENT PROCESSING code to go here
******************************************************************
*
* Return to caller
EXEC CICS RETURN END-EXEC.
*
Main-program-exit.
exit.
*
******************************************************************
Initial-processing section.
******************************************************************
*
* Obtain the DFHEP.CONTEXT container
EXEC CICS GET CONTAINER('DFHEP.CONTEXT')
SET(address of EPContext)
FLENGTH(EPContextLength)
END-EXEC.
*
* Obtain the DFHEP.DESCRIPTOR container
EXEC CICS GET CONTAINER('DFHEP.DESCRIPTOR')
SET(address of EPDescriptor)
FLENGTH(EPDescriptorLength)
END-EXEC.
*
* Obtain the DFHEP.ADAPTER container
EXEC CICS GET CONTAINER('DFHEP.ADAPTER')
SET(address of EPAdapter)
FLENGTH(EPAdapterLength)
END-EXEC.
*
* Obtain the DFHEP.ADAPTPARM container
EXEC CICS GET CONTAINER('DFHEP.ADAPTPARM')
SET(address of EPAdaptparm)
FLENGTH(EPAdaptparmLength)
END-EXEC.
*
* Check the recoverability of the transport is right for the event
if not epap-any-recoverable
perform Check-recoverability.
*
Initial-processing-exit.
exit.
*
******************************************************************
Process-data-item section.
******************************************************************
*
* Process a data descriptor item
*
* Build the data container name: DFHEP.DATA.nnnnn
string 'DFHEP.DATA.' delimited by size
ItemNum delimited by size
into ContainerName
end-string.
*
* Obtain the DFHEP.DATA.nnnnn container - if present
EXEC CICS GET CONTAINER(ContainerName)
SET(address of EPData)
FLENGTH(EPDataLength)
RESP(Resp) RESP2(Resp2)
END-EXEC.
******************************************************************
* Any final code to process DATA ITEM to go here
******************************************************************
*
* Convert the data according to epde-datatype
perform Convert-data.
*
* Calculate the target field length
move epde-formatlen of epde-item(ItemNum) to TSQFieldLength
if TSQFieldLength = 0 and Resp = dfhresp(normal)
move TSQItemLength to TSQFieldLength
end-if
if 32001 - TSQFieldIndex < TSQFieldLength
compute TSQFieldLength = 32001 - TSQFieldIndex
end-if.
*
* Format the data according to epde-formattype
perform Format-data.
*
* Move over the data item ready for the next one
add TSQFieldLength to TSQFieldIndex.
*
Process-data-item-exit.
exit.
*
******************************************************************