Submitted by Anonymous (not verified) on Thu, 01/08/2015 - 00:00
Forums

Hi,

Can I have local scoped ILOB or put in other words: Do I need to give ILOBs global names?

Niels Liisberg

Thu, 01/08/2015 - 00:00

Hi,

Since BUILD0448 you can use ilob_new() and ilob_delete() which gives you locally scoped ILOBs. These are perfect for temporary huge memory trunks like SOAP and other web service calls.

The following sample illustrates the usages:

<%@ language="RPGLE" %>
<%
/* -------------------------------------------------------------------------------------------- *\
 * Demo:
 *
 * Using anonymous ILOB
 *
\* -------------------------------------------------------------------------------------------- */

// Include the ILOB interface
/include qasphdr,ilob

var pIlob ptr
var i     int(10)

/free

        *INLR = *ON;
        // Create a temporary anonymous ilob
        // It resides in QTEMP so it is not static available.
        // Only use within the program scope
        pIlob = ilob_New();

        // Do stuff with the ILOB
        for i = 1 to 100;
                ilob_Append(pIlob: %char(%timestamp()));
                ilob_Append(pIlob: x'0d25');
        endfor;

        // Now print the list just for fun
        %><html><pre><%
        responseWriteIlob(pIlob);
        %></pre></html><%

        // Dispose it.
        // it resides in QTEMP so you can also just leave it, and let it be removed when the job ends
        ilob_Delete(pIlob);

 

Best regards,

Niels Liisberg