*ASM XOPTS(CICS,SP,NOEDF,NOPROLOG,NOEPILOG) ADKJSONA DFHEIENT ADKJSONA AMODE 31 ADKJSONA RMODE ANY * * Dynatrace support for CICS JSON pipelines is only provided for * pipelines that use the default JSON terminal handler DFHPIJT. * * The CICS SDK code in this example can be added to a custom * terminal handler program to avoid that limitation. * * First, we will look for a X-dynaTrace header in the request. * If it is fouund, use the DTSLPTF API to start a Purepath using * the tag that was provided in the value of that header. * * Using this technique, there is no need to add the ZDTSOAPH * program to the pipeline definition file. * LHI R0,L'HDRVALUE Get header value buffer size ST R0,HDRVLEN Set max length Of HTTP header value EXEC CICS WEB READ HTTPHEADER(HDRNAME) * VALUE(HDRVALUE) * VALUELENGTH(HDRVLEN) * NOHANDLE L R0,EIBRESP Get RESP CHI R0,OK RESP OK? JE CALLSDK Yes, proceed to start a Purepath CHI R0,NOTFND Header missing? JNE HDRERR No, unexpected error EXEC CICS WRITE OPERATOR TEXT('Untagged request received.') J SDKDONE Bypass SDK call CALLSDK DS 0H CALL DTSLPTF,(HDRVALUE,HDRVLEN),MF=(E,PLIST) LTR R15,R15 RC zero? JZ SDKDONE Yes, all done JNM SDKERR Positive, bad return code EXEC CICS WRITE OPERATOR TEXT('Dynatrace agent not active') J SDKDONE Nothing more to do HDRERR DS 0H MVC MSG_API,=CL8'WEB READ' MVC MSG_TEXT,=CL16' returned RESP ' CVD R0,DWORD UNPK MSG_RC,DWORD OI MSG_RC+L'MSG_RC-1,X'F0' J WRITERR SDKERR DS 0H MVC MSG_API,=CL8'DTSPTF' MVC MSG_TEXT,=CL16'API returned RC ' CVD R15,DWORD UNPK MSG_RC,DWORD OI MSG_RC+L'MSG_RC-1,X'F0' WRITERR DS 0H EXEC CICS WRITE OPERATOR TEXT(ERR_MSG) SDKDONE DS 0H * The code that was added for the Dynatrace CICS SDK ends here. * The rest is intended to represent the existing handler code. EXEC CICS LINK PROGRAM('TSTDB201') COMMAREA(TDB2COMM) EXEC CICS DELETE CONTAINER(=CL16'DFHRESPONSE') NOHANDLE DFHEIRET LTORG HDRNAME DC C'X-dynaTrace' Name of header that contains the tag TDB2COMM DC C'0005' Commarea for application program OK EQU 0 NOTFND EQU 13 DFHEISTG DWORD DS D PLIST CALL ,(,,),MF=L ERR_MSG DS 0CL27 MSG_API DS CL8 MSG_TEXT DS CL16 MSG_RC DS CL3 HDRNAMEL DS F Length Of HTTP header name HDRVLEN DS F Length Of header value buffer HDRVALUE DS CL200 HTTP header value buffer DFHEIEND DFHREGS END ADKJSONA