× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I find that I have to have an SQL indicator array that is overlaid
with a matching data structure so that I can have both named indicators
and subscripted indicators. Anybody else find that to be true? I find
that I need both because the SQL precompiler will not iterate an indicator
data structure but will also not allow the use of subscripts from the
indicator array. For example... The following is not allowed:

exec sql execute IMLFCMDRSM_Update_Stmt
using :IMLFCMP_View1.CiCompPTID :IMLFCMP_Ary(2)
, :IMLFCMP_View1.ImLfSeqTID :IMLFCMP_Ary(3)
, :IMLFCMP_View1.BoyExtTtl :IMLFCMP_Ary(4)
, :IMLFCMP_View1.YtdExtTtl :IMLFCMP_Ary(5)
, :IMLFCMP_View1.ExtIdx :IMLFCMP_Ary(6)
, :IMLFCMP_View1.AbsRto :IMLFCMP_Ary(7)
, :IMLFCMP_View1.TmsLstExt :IMLFCMP_Ary(8)
, :IMLFCMP_View1.TmsLstLRl :IMLFCMP_Ary(9)
, :IMLFCMP_View1.TmsLclCmp :IMLFCMP_Ary(10)
, :IMLFCMP_View1.TmsCrpAct :IMLFCMP_Ary(11)
, :IMLFCMP_View1.ChgByUsr :IMLFCMP_Ary(15)
, :IMLFCMP_View1.ChgByPgm :IMLFCMP_Ary(16)
, :IMLFCMP_View1.IMLFCMPTID
, :IMLFCMP_View1.ChgTs;

Instead, I have to do this:

exec sql execute IMLFCMDRSM_Update_Stmt
using :IMLFCMP_View1.CiCompPTID :IMLFCMP_Ind.CiCompPTID
, :IMLFCMP_View1.ImLfSeqTID :IMLFCMP_Ind.ImLfSeqTID
, :IMLFCMP_View1.BoyExtTtl :IMLFCMP_Ind.BoyExtTtl
, :IMLFCMP_View1.YtdExtTtl :IMLFCMP_Ind.YtdExtTtl
, :IMLFCMP_View1.ExtIdx :IMLFCMP_Ind.ExtIdx
, :IMLFCMP_View1.AbsRto :IMLFCMP_Ind.AbsRto
, :IMLFCMP_View1.TmsLstExt :IMLFCMP_Ind.TmsLstExt
, :IMLFCMP_View1.TmsLstLRl :IMLFCMP_Ind.TmsLstLRl
, :IMLFCMP_View1.TmsLclCmp :IMLFCMP_Ind.TmsLclCmp
, :IMLFCMP_View1.TmsCrpAct :IMLFCMP_Ind.TmsCrpAct
, :IMLFCMP_View1.ChgByUsr :IMLFCMP_Ind.ChgByUsr
, :IMLFCMP_View1.ChgByPgm :IMLFCMP_Ind.ChgByPgm
, :IMLFCMP_View1.IMLFCMPTID
, :IMLFCMP_View1.ChgTs;

Then for an INSERT, the following is not allowed:

exec sql execute IMLFCMDRSM_Insert_Stmt
using :IMLFCMP_View1 :IMLFCMP_Ind;

Instead, I have to do this:

exec sql execute IMLFCMDRSM_Insert_Stmt
using :IMLFCMP_View1 :IMLFCMP_Ary;

On the flip side, it is a nuisance (to me) to have to manually
create and maintain such a data structure. So, has anybody come up with a
means of automatically generating an SQL indicator array with an overlaid
data structure that matches the RPG-generated data structure for an
external SQL view reference? If not, maybe it is time for an RFE?

To give you an example, the following is my manually-created
indicator data structure that goes with the above:

// number of columns in SQL row
dcl-c IMLFCMP_VCol1 17;
dcl-c IMLFCMP_VCol2 30;

// data structures for SQL column data
dcl-ds IMLFCMP_View1 extname('IMLFCMPV01') qualified inz end-ds;
dcl-ds IMLFCMP_View2 extname('IMLFCMPV02') qualified inz end-ds;

// SQL indicator array with overlay of named indicators
dcl-s IMLFCMP_Ary like(NULL_VALUE) dim(IMLFCMP_VCol2) inz;
dcl-s IMLFCMP_Ptr like(pointer_t) inz(%addr(IMLFCMP_Ary));
dcl-ds IMLFCMP_Ind based(IMLFCMP_Ptr) qualified;
ImLfCmpTID like(NULL_VALUE);
CiCompPTID like(NULL_VALUE);
ImLfSeqTID like(NULL_VALUE);
BoyExtTtl like(NULL_VALUE);
YtdExtTtl like(NULL_VALUE);
ExtIdx like(NULL_VALUE);
AbsRto like(NULL_VALUE);
TmsLstExt like(NULL_VALUE);
TmsLstLRl like(NULL_VALUE);
TmsLclCmp like(NULL_VALUE);
TmsCrpAct like(NULL_VALUE);
AddByUsr like(NULL_VALUE);
AddByPgm like(NULL_VALUE);
AddTs like(NULL_VALUE);
ChgByUsr like(NULL_VALUE);
ChgByPgm like(NULL_VALUE);
ChgTs like(NULL_VALUE);
CiCompTID2 like(NULL_VALUE);
CIORGKY like(NULL_VALUE);
CIORGNM like(NULL_VALUE);
CITYPID like(NULL_VALUE);
CIIKEY like(NULL_VALUE);
CIAKEY like(NULL_VALUE);
CISTAT like(NULL_VALUE);
CICRPTYP like(NULL_VALUE);
CISKEY like(NULL_VALUE);
CITIER like(NULL_VALUE);
ExtSeqCde like(NULL_VALUE);
ExtSeqDsc like(NULL_VALUE);
ExtSeqOrd like(NULL_VALUE);
end-ds;

Thoughts? Reactions? Thanks.

Sincerely,

Dave Clark

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.