Stored procedure in CICS popular example to invoke it

Yes, you 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 to CALL stored proc in CICS

EXEC SQL
     CALL EMPRSETC(

                    :PDEPTNO
                   ,:PDEPTNAME
                   ,:PSQLCODE
                   ,:PSQLSTATE
                   ,:PSQLERRMC
                  )
END-EXEC.

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.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.