We are trying to introduce multi-row Inserts in our COBOL DB2 modules, replacing the existing single row inserts. While introducing this, we want to retain the existing Single row INSERT and UPDATE queries in the program , so that anyone who desires to could use this.
The single row insert works just fine even while providing an array as host variable, by passing the values only to the first row of array before inserting. We are not sure if the performance will be impacted by this.
However, while trying to keep the Update statement, the recompile of the program failed.
In the COBOL module, we will have 2 queries on either sides of an IF statement. First, to insert one row of input at a time with an INSERT statement, and the next to be able to INSERT multiple rows. While running the program, we can pass a parameter in the JCL to control which of the options would be used.
Now, I can't declare the table twice in the program (one for each query) to be able to use a DCLGEN. So I declare it once, defining the the cobol variables as an array. I want to be able to use this same COBOL variable as a host variable, and use them for my Multi-Insert, single row Insert and run an UPDATE query as well on the table, based on the PARM passed in the JCL. When I attempt this, the compiler gives me an error in Changeman (for the UPDATE SQL).