DB2 Stored Proc from CICS-How

Yes, we can access Db2 stored proc from CICS.

CICS transaction manager comes with DB2 attachment facility.This is the reason CICS can access DB2 stored procedure from CICS.

Every CICS region can access only one DB2 sub-system.

  • Stored procedures are accessed from CICS programs by issuing SQL CALL statements
  • A CALL statement that references a stored procedure must be bracketed between EXEC SQL and the statement terminator appropriate for the host language
  • For COBOL programs, the statement terminator is END-EXEC

An example:



Note:The CICS application program must include logic to set the host variables prior to executing the CALL, and must include logic to handle any error conditions returned by the stored procedure. These two logic components are no different than what is required of a batch program written in the same host language.

Refer more in the link from IBM.