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..
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 9:14 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Max length of a VARYING field
The discussion has eovled primarily around syntax. The consensus
between
Scott and Barbara seems to be that something like VARYING(2) for normal
fields and VARYING(4) for longer indices or for special conditions would
be
the best solution, for a number of reasons they've already given. Thus,
you
get the following:
D mySmallVar s 256A VARYING(2)
This is the standard.
D mySmallVar s 256A VARYING(4)
This says 256 byte field, but with a 4-byte prefix.
D myBigVar s 100000A VARYING(4)
This is a 100,000 byte field, prefix 4.
D myBigVar s 100000A VARYING(2)
And this, I assume, is a syntax error.
In order to make it so that new programmers who don't care about prefix
sizes don't ever need to even know about it, and additionally to allow
backwards compatibility to all existing code, I would respectfully ask
that
the following be considered.
D mySmallVar s 256A VARYING
D myBigVar s 100000A VARYING
In these cases, mySmallVar would default to VARYING(2) and myBigVar
would
default to VARYING(4) without any additional code required. For someone
who
isn't interested in internals, the keyword would be consistent and
nobody
would care. Those requiring compatibility with APIs and such could
always
override the VARYING keyword as needed.
This seems to me to be the most flexible compromise: easiest for the new
programmer yet ultimately flexible for the experts.
Joe
As an Amazon Associate we earn from qualifying purchases.