Skip to Main Content
IBM Power Ideas Portal


This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Future consideration
Workspace IBM i
Categories Db2 for i
Created by Guest
Created on Sep 1, 2022

Enhanced SQL Call Level Interface (CLI) resource management options

Today, a CLI (SQL Call Level Interface) environment handle allocated via the SQLAllocEnv() API is automatically tied to the callstack entry which allocated it, meaning that when that program leaves the stack, the system deems the environment handle fair game for automatic cleanup. What we're looking for is an override switch to this functionality, where a CLI environment handle (and all associated resources) can optionally be 'flagged' as being managed by the caller, rather than by the system (perhaps SQL_HANDLE_MANAGEMENT_AUTO/CALLER; default AUTO). Really any method to prevent this automatic cleanup of environment/connection resources will do - the setting of a system environment variable or whatever, we don't mind. The point here is, the CLI suite of APIs is excellent, and we - and I suspect others as well - would like to be able to do more with it. The value of any good API is that it crystallises a specific function such that it can be re-used more easily. Iteratively re-using established APIs / BIFs to build additional layers of programming tools is how we keep evolving our coding practices and the complexity/flexibility of our coded solutions. What this memory management limitation of the CLI effectively does is prevent the allocation of key resource handles in certain containerized functional blocks - specifically procedures exported from a service program. If a (RPG) service program were to be developed offering helper APIs for xConnect(), xQuery(), xRead(), etc., the inner workings of these functions could (for example) automatically describe the dynamic result sets, allocate and bind buffers, perform blocked fetches, protecting the calling program from the relative complexity required. If the CLI cannot support resources being instantiated from atomic, exported service program procedures in this way, however, (because the service program in this case only briefly remains on the call stack), then such a toolset becomes seemingly impossible to realise with CLI. In my view this criminally restricts the usefulness of the CLI, which would otherwise offer the most powerful SQL interface (for DB2i connections) on the iSeries platform. I suspect this limitation is borne out of good intentions, rather than willfull restriction of the tool. But early issues with memory management in the original incarnations of the CLI are a distant memory by this point, and I think the time has come to allow these handles to be explicitly managed by the application programmer in certain circumstances. What do you think?
Idea priority Low
  • Guest
    Reply
    |
    Oct 1, 2022
    IBM will use this Idea as input to planning, but no commitment is made or implied. This Idea will be updated in the future if IBM implements it.
  • Guest
    Reply
    |
    Sep 20, 2022

    Just in response to the comment from 14th...

    The resources won't get freed up immediately, but in a long-running job they are likely to get cleanup up and we have had this happen in our application environments. We've been in contact with IBM and they confirmed that CLI isn't currently compatible with this usage (i.e. initialisation of the environment/connection handles from a service program 'utility' procedures) for exactly this reason. Like I say, it will very often work without issue depending on the use case, but for longer running jobs which idle between client requests (for example), things will go bad at some point. If we could just get the same option QSQPRCED offers for activation group scoping also under CLI, that would be fantastic.

    (by the way we always use ACTGRP(*CALLER))

  • Guest
    Reply
    |
    Sep 14, 2022

    I'm confused. I use CLI in C programs and things don't get freed when a program leaves the stack. Perhaps you are using an Activation Group new for your service program and the activation group goes away when the procedure in the service program returns.

  • Guest
    Reply
    |
    Sep 5, 2022

    I just wanted to add: we note that the Extended Dynamic SQL interface QSQPRCED notes similar scoping of resources to a calling program (albeit one which the caller names), and that once this program leaves the callstack the associated resources will be cleaned up. The difference here is that this can be overriden by instead scoping those resources to the Activation Group. This would be a perfect solution for us also under CLI.

1 MERGED

Enhanced memory management option for SQL Call Level Interface (CLI)

Merged
Today, a CLI (SQL Call Level Interface) environment handle allocated via the SQLAllocEnv() API is automatically tied to the callstack entry which allocated it, meaning that when that program leaves the stack, the system deems the environment handl...
over 2 years ago in IBM i / Db2 for i 2 Future consideration