"MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx> wrote on 05/09/2018
02:24:52 PM:
I've used SQL Extended Indicators with RPG and dynamic SQL. But
I
wonder if SQL Extended Indicators can also be used with static SQL?
Also,
are Extended Indicators honored in an internal (i.e., LANGUAGE SQL)
stored
procedure?
I ask, because I can't get them to be accepted in one of my stored
procedures and I am wondering what I am doing wrong. I have four columns
that sometimes I want to update and sometimes I don't. So I start with
this:
Declare BgnYrCst_Ind SmallInt Default 0;
Declare EndYrCst_Ind SmallInt Default 0;
Declare EndQtyHnd_Ind SmallInt Default 0;
Declare EndQtyHld_Ind SmallInt Default 0;
Declare IGNORE_VALUE SmallInt Default -7;
If BgnYrCst is NULL Then
Set BgnYrCst_Ind = IGNORE_VALUE;
End If;
If EndYrCst is NULL Then
Set EndYrCst_Ind = IGNORE_VALUE;
End If;
If EndQtyHnd is NULL Then
Set EndQtyHnd_Ind = IGNORE_VALUE;
End If;
If EndQtyHld is NULL Then
Set EndQtyHld_Ind = IGNORE_VALUE;
End If;
Then I tried these two formats for static SQL:
Update QTEMP/IMLFADJA
Set BgnYrCst = BgnYrCst BgnYrCst_Ind
, EndYrCst = EndYrCst EndYrCst_Ind
, EndQtyHnd = EndQtyHnd EndQtyHnd_Ind
, EndQtyHld = EndQtyHld EndQtyHld_Ind
, ChgByUsr = SESSION_USER
, ChgByPgm = 'IMLFADJSP'
Where ImLfAdjTid = AdjTid;
SQL0104 Position 32 Token BGNYRCST_IND was not valid.
Update QTEMP/IMLFADJA
Set BgnYrCst = BgnYrCst INDICATOR BgnYrCst_Ind
, EndYrCst = EndYrCst INDICATOR EndYrCst_Ind
, EndQtyHnd = EndQtyHnd INDICATOR EndQtyHnd_Ind
, EndQtyHld = EndQtyHld INDICATOR EndQtyHld_Ind
, ChgByUsr = SESSION_USER
, ChgByPgm = 'IMLFADJSP'
Where ImLfAdjTid = AdjTid;
SQL0199 Position 32 Keyword INDICATOR not expected.
And I tried these two formats for dynamic SQL (the first one works
in RPG):
Execute IMLFADJSP_STMT Using BgnYrCst BgnYrCst_Ind
, EndYrCst EndYrCst_Ind
, EndQtyHnd EndQtyHnd_Ind
, EndQtyHld EndQtyHld_Ind
, SESSION_USER
, 'IMLFADJSP'
, AdjTid;
SQL0104 Position 41 Token BGNYRCST_IND was not valid.
Execute IMLFADJSP_STMT Using BgnYrCst INDICATOR BgnYrCst_Ind
, EndYrCst INDICATOR EndYrCst_Ind
, EndQtyHnd INDICATOR EndQtyHnd_Ind
, EndQtyHld INDICATOR EndQtyHld_Ind
, SESSION_USER
, 'IMLFADJSP'
, AdjTid;
SQL0199 Position 41 Keyword INDICATOR not expected.
Nothing is accepted. What is wrong? Thanks.
Sincerely,
Dave Clark
As an Amazon Associate we earn from qualifying purchases.