It is not clear to me why your program closes the sqlite3 database at the end of each C function invocation. AFAIK sqlite3 should not close any database connection unless your program invokes sqlite3_close. If something in the "Language Environment" closes and releases internal resources at the end of each C function call then this would be an issue with your z/OS environment.
Assuming that the "Language Environment" does not automatically release resources, I can think of a the following alternative approaches: 1: C code opens the database and stores the handle in a static variable. 2: C code opens the database and returns the pointer to the assembly code; assembly code would then include the returned pointer value in subsequent calls to the C code. 3a: C code opens the database, stores it in a structure on the heap, and returns the pointer to the structure back to the assembly code which is then used in subsequent calls to the C code 3b: C code opens the database, stores it in a structure on the heap, maintains some kind of hash table or other key-value map, and returns a numerical value to the assembly program which is then used in subsequent calls to the C code I suspect it should be pretty straightforward (easy) to search for documentation on each of the approaches above. I think this could be similar to interfacing between C and higher-level languages such as Java, Python, C++, etc. I would compare alternatives 2 and 3a to how FILE pointers work between stdlib and C programs, also to how sqlite3 database pointers work between sqlite3 library and application code in C.. I hope this is helpful to you and other readers on the list. Please do not hesitate to ask if anything does not sound right or is not clear. Chris https://www.linkedin.com/in/chrisbrody/ On Wed, Aug 29, 2018 at 6:26 PM David Jackson <davidkjackso...@gmail.com> wrote: > > Having successfully ported sqlite to z/OS Unix as a 32 bit app, I am now > looking at a c program to make SQL calls to this. > Starting with an Assembler routine that runs within z/OS (not Unix), which > is not LE (Language Environment)enabled, we then call a c routine (numerous > times) that is LE enabled. That is all working fine and making good SQL > calls to sqlite. the c program then returns back to the upper assembler > calling program. The problem is that the c routines is opening, issuing the > SQL and closing on each invocation. > > Now this may be a dumb question, so apologies up front. > Is there any way that the c program can open the sqlite db initially on the > first call and keep it open after it returns back to the calling program > until a final call at which point it will issue the sqlite3_close. > > Again - sorry if this was a dumb question. > > Thanks > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users