Well I know several people (myself included) that bypass the index bytes
by using %SUBST ... Mydata = %subst(myvaryfld:3:x) don't ask me where
because it escapes me at the moment (old timer's is setting in) if the
index byte size is not known and all this stuff is setup using a value
of 2 (via constants or whatever) there WILL be problems...but you're
right, you can idiot-proof all you want they'll just build better
idiots...
Thanks,
Tommy Holden
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[
mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Joe Pluta
Sent: Thursday, May 17, 2007 10:23 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Max length of a VARYING field
From: Holden Tommy
Add a %indexsize BIF and you're home free...but somewhere there will
have to be a means to determine the index byte size...if not then
there
will be issues when someone "assumes" (bad word) that there will
always
only 2 bytes for the index..
I understand your point, Tommy, and I agree that the %indexsize BIF
would be
a good idea. At the same time, you can't protect everybody from
everything.
The only reason you need to know about the size of the prefix is if
you're
relying on that size for something, and programmers who rely on the
index
size ought to know about specifying it using the VARYING clause.
Note that I'm not trying to take away the ability to explicitly specify
the
index size. I'm just trying to make it so that the people who don't
need to
know about the prefix still don't need to know about it. Heck, I'd
guess
that there are plenty of people using VARYING today who don't know or
care
about the size or location of the prefix (or that one even exists). I'm
sure they'd like to continue using the keyword without having to tell
the
compiler what size to use!
In fact, who do you think use the keyword more? People who need to know
the
size of the prefix field, or people who don't?
Joe
As an Amazon Associate we earn from qualifying purchases.