× 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.



Hi Joe,

I agree with this scenario, with a couple of questions.

Why VARYING(x) as opposed to VARYINGx? The former implies (to me anyway) that I can put whatever I want in there -- VARYING(1), VARYING(7), etc. Or maybe that's the intention; after all, why not? Let's be flexible. Aren't all these 2-byte, 4-byte integers simply those sizes because they're closer to what the hardware can handle? But isn't RPG supposed to be a little more hardware independent than that? After all, I don't have to know the size of a disk sector in order to read a record from a file.

Later responses mention a %indexsize BIF. Index? It's a current length subfield isn't it?. How about %sizelen, or %lensize or something? Unless it's considered an index to the end of the string...but I think most people think of it as the current length, hence the %len BIF.

*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
pdow@xxxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxxx> /

Joe Pluta wrote:
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.