REXX for CICS TS: Db2 interface
The REXX Db2 interface provides a means of executing SQL statements and Db2 commands from a REXX exec.
The SQL are prepared and executed dynamically. You issue the Db2 commands by using theDb2 instrumentation facility interface (IFI). The REXX Db2 interface provides the results of the SQL in REXX predefined variables. The REXX Db2 interface supports DB2® Version 2.3 and later. This information explains how to use the interface to Db2 from REXX for CICS® TS.
For more information about SQL statements or Db2 commands, see SQL: The language of Db2 in Db2 for z/OS product documentation and Db2 commands. For more information about IFI, see Programming for the instrumentation facility interface (IFI) in Db2 for z/OS product documentation.
Programming considerations
To embed SQL within a REXX exec, the host command environment must be changed. The ADDRESS instruction, followed by the name of the environment, is used to change the host command environment.
The ADDRESS instruction has two forms; one affects all commands issued after the instruction, and one affects only a single command. For more information about host command environments, see Changing the host command environment. For more information about the ADDRESS instruction, see ADDRESS.
- EXECDB2 is the command environment that supports Db2 commands.
- EXECSQL is the command environment that supports SQL statements.
REXX for CICS TS provides an exec called CICRXTRY that can be used to process REXX statements and commands interactively. CICRXTRY can be pseudo-conversational. The PSEUDO and SETSYS PSEUDO commands are used to turn pseudo-conversational mode on or off. If the environment is set to pseudo-conversational, SQL statements issued from CICRXTRY will be committed. If the environment is set to conversational, any SQL statements issued from the CICRXTRY exec will not be committed and any resources that are locked will remain locked until you exit the CICRXTRY exec or issue a CICS SYNCPOINT command. Similar considerations should be made if embedding SQL statements in lengthy REXX execs.