David L Clark/it/crp/WinWholesale wrote on 10/06/2016 09:57:13 AM:
... the RPG compiler already has a %parms() built-in similar to $argc.
So, it sure would be a lot easier if the RPG compiler provided a
%parma() or %parmv() built-in to reference a parameter list as a
pointer array -- similar to $argv[].
By the way.... That *is* how I ended up using CEETSTA:
// build minimum fields (by key) to satisfy request
RTSFA_KCnt = 2; // at least two keys required
RTSFA_Keys(1) = RTSFA_Codes(1); // key code for internal job
ident
RTSFA_Keys(2) = RTSFA_Codes(2); // key code for internal splf
ident
for RTSFA_CCnt = 3 by 1 to (%elem(RTSFA_Codes) - 1);
ParmNumb = RTSFA_CCnt + 3; // match to a parm number
callp CEETSTA(ValidParm: ParmNumb: iFeedback); // test it
if %parms >= ParmNumb // if parm passed
and ValidParm > *zero; // and not omitted
RTSFA_KCnt += 1; // increment key count
RTSFA_Keys(RTSFA_KCnt) = RTSFA_Codes(RTSFA_CCnt);
if RTSFA_Codes(RTSFA_CCnt) = 223; // special key code
RTSFA_KCnt += 1; // increment key count
RTSFA_Keys(RTSFA_KCnt) = 222; // for matching key pair
endif;
endif;
endfor;
It would have just been *so* much more convenient if I could have
coded that as follows.
// build minimum fields (by key) to satisfy request
RTSFA_KCnt = 2; // at least two keys required
RTSFA_Keys(1) = RTSFA_Codes(1); // key code for internal job
ident
RTSFA_Keys(2) = RTSFA_Codes(2); // key code for internal splf
ident
for RTSFA_CCnt = 3 by 1 to (%elem(RTSFA_Codes) - 1);
ParmNumb = RTSFA_CCnt + 3; // match to a parm number
if %parms >= ParmNumb // if parm passed
and %parma(ParmNumb) <> *null; // and not omitted
RTSFA_KCnt += 1; // increment key count
RTSFA_Keys(RTSFA_KCnt) = RTSFA_Codes(RTSFA_CCnt);
if RTSFA_Codes(RTSFA_CCnt) = 223; // special key code
RTSFA_KCnt += 1; // increment key count
RTSFA_Keys(RTSFA_KCnt) = 222; // for matching key pair
endif;
endif;
endfor;
But, I've got something that is working so all's well that ends
well. Thanks all.
Sincerely,
Dave Clark
As an Amazon Associate we earn from qualifying purchases.