Using Gen z/OS IT and noticed after the Execute step was run that these extra lines are added to the code originally extracted from the .RMT file generated from the Client Server Encyclopedia (CSE)/ Workstation Toolset:* FOLLOWING LINE ADDED POST-GENERATION
* TO RE-INITIALIZE FOR DYNAMIC CALLS
MOVE ZERO TO SQL-INIT-FLAG.
Is there a reason for this?
Component: Gen z/OS implementation Toolset, Gen Host Encyclopedia, Gen Construction
From IBM COBOL Programming Guide e.g. Enterprise COBOL for z/OS 6.4 Programming Guide
===
SQL-INIT-FLAG
Precompiler: With the Db2 precompiler, if you pass host variables that might be located at different addresses when the program is called more than once, the called program must reset SQL-INIT-FLAG. Resetting this flag indicates to Db2 that storage must be initialized when the next SQL statement runs. To reset the flag, insert the statement MOVE ZERO TO SQL-INIT-FLAG in the PROCEDURE DIVISION of the called program ahead of any executable SQL statements that use those host variables.
Coprocessor: With the Db2 coprocessor, the called program does not need to reset SQL-INIT-FLAG. An SQL-INIT-FLAG is automatically defined in the program to aid program portability. However, statements that modify SQL-INIT-FLAG, such as MOVE ZERO TO SQL-INIT-FLAG, have no effect on the SQL processing in the program.
===
Gen still uses the DB2 Precompiler, which is why that extra line of code is added to prevent potential problems if the member is called more than once at execution time.
z/OS IT script TIXMVSLM calls clist TICEDINI which in turn calls edit macro EDITINIT to add the code.
Host Encyclopedia Construction also calls the TICEDINI clist from the TICINSTX program that gets invoked during the application installation process. The clist gets called for source members that contain SQL and are called dynamically. The clist then runs the EDITINIT edit macro to add the "MOVE ZERO TO SQL-INIT-FLAG" line to the generated code. Note that the clist only gets called if the source member needs to be compiled.