× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.