IDENTIFICATION DIVISION. PROGRAM-ID. ADKJSONC. * 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. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 WS_HEADER_VALUE PIC X(200). 77 WS_HEADER_VALUELEN PIC S9(9) COMP VALUE 200. 77 WS_HEADER_NAME PIC X(11) VALUE "X-dynaTrace". 77 WS_RESP PIC S9(9) COMP. 77 WS_RESP2 PIC S9(9) COMP. 77 RC PIC S9(9) COMP. 77 TDB2_COMMAREA PIC X(4) VALUE "0005". 01 WS_ERROR_MSG. 05 WS_ERROR_FUNC PIC X(11) VALUE "READ HEADER". 05 FILLER PIC X(18) VALUE " failed with RESP=". 05 WS_ERROR_RESP PIC ZZ9. 05 FILLER PIC X(8) VALUE " RESP2=". 05 WS_ERROR_RESP2 PIC ZZ9. 01 WS_SDK_MSG. 05 WS_SDK_API PIC X(8) VALUE "DTSLPTF ". 05 WS_SDK_TEXT PIC X(16) VALUE "API returned RC ". 05 WS_SDK_RC PIC ZZ9. PROCEDURE DIVISION. EXEC CICS WEB READ HTTPHEADER(WS_HEADER_NAME) VALUE(WS_HEADER_VALUE) VALUELENGTH(WS_HEADER_VALUELEN) RESP(WS_RESP) RESP2(WS_RESP2) END-EXEC. IF WS_RESP EQUAL DFHRESP(NORMAL) PERFORM START_PATH PERFORM EXISTING_PROGRAM. IF WS_RESP EQUAL DFHRESP(NOTFND) DISPLAY "Untagged request received." PERFORM EXISTING_PROGRAM. MOVE WS_RESP TO WS_ERROR_RESP. MOVE WS_RESP2 TO WS_ERROR_RESP2. DISPLAY WS_ERROR_MSG. PERFORM EXISTING_PROGRAM. START_PATH. CALL "DTSLPTF" USING WS_HEADER_VALUE, WS_HEADER_VALUELEN RETURNING RC. IF RC GREATER THAN ZERO MOVE RC TO WS_SDK_RC DISPLAY WS_SDK_MSG. IF RC LESS THAN ZERO DISPLAY "Dynatrace agent not active.". * The code to be added for the Dynatrace CICS SDK ends here. * The rest is intended to represent the existing handler code. EXISTING_PROGRAM. EXEC CICS DELETE CONTAINER('DFHRESPONSE') END-EXEC. EXEC CICS LINK PROGRAM('TSTDB201') COMMAREA(TDB2_COMMAREA) END-EXEC. EXEC CICS RETURN END-EXEC.