My understanding is that anything defined with keyword TEMPLATE is only
available at compile time. You can't use them in the program at execution
time. TEMPLATEs are only meant to globally define a value that is to be
used to define other values within the program/procedure.
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Kurt
Anderson
Sent: Friday, June 06, 2014 1:42 PM
To: RPG programming on the IBM i / System i (rpg400-l@xxxxxxxxxxxx)
Subject: %DecPos on a template variable
I tried using %decpos on a template variable, and it wouldn't let me:
editCode = $GetUsageAmountEditCode( %decPos( dsT_Inv_State.SBeg )
);
RNF0655: Item SBEG was defined with TEMPLATE and cannot be used in this
context.
RNF0655: Item DST_INV_STATE was defined with TEMPLATE and cannot be used in
this context.
dsT_Inv_State is indeed a template data structure, but I don't understand
why this won't work. Unlike %len, which returns the length of a field which
can fluctuate if it's a varchar, I don't see how %decpos could be anything
but the decimal precision of the field at compile time. Am I missing
something here? We're at IBM i 7.1.
In this particular case, I have two amount fields defined like the SBeg
subfield mentioned above. I wanted to get the %decpos of the field that the
amount fields are being defined like, instead of arbitrarily picking one
(what if one goes away with a future change, then this procedure call will
have to change as well).
And in case anyone's wondering what in the world I'd do with an edit code in
a variable since %editC doesn't support a variable as the second parameter
(sigh), I have another procedure that translates it into an %editC with the
hardcoded edit code.
Thanks,
Kurt Anderson
Sr. Programmer/Analyst - Application Development, Service Delivery Platform
[cid:image002.jpg@01CD16F9.25D27630]
web: www.customcall.com<
http://www.customcall.com/> | email:
kurt.anderson@xxxxxxxxxxxx<mailto:kurt.anderson@xxxxxxxxxxxx>
A Division of Enghouse Systems Ltd.<
http://www.enghouse.com/> (TSX:ESL)
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.