I find that this whole thread based on fantasy and nearly specious reasoning.
First, IBM has not made a change.
Second, we don't get to make the decisions on the compiler design--comment, yes,
but not decide.
Third, who cares if they need a 4-byte or 8-byte prefix as well as a 2-byte?
They aren't ever going to change existing implementations so why say "woo is me
if they do". They won't.
Last, when the add a larger variable length field, how the specify the syntax is
important but doesn't hinder existing code in any way. VARYING defaults to a
2-byte int hidden length, and another syntax will specify "bigger".
Personally, I prefer to use a different keyword, such as VARLEN(x) with a
default of a 4-byte int hidden length, but VARYING(4) or VARYING(*LARGE) is also
(almost) as good. It also forces your eye to that code so that you realize it
isn't a 2-byte hidden length. :)
As for teaching this to people, gosh, let's see, shall I start the list of
things that are inconsistent in RPG IV and have to be pounded into students? How
about the default data-type for numeric fields when the data-type is
unspecified? Sometimes packed, sometimes zoned numeric. How about trying to
teach people to type in 10i 0 instead of 4i0 for a 4-byte integer, not to
mention trying to get them to use an integer data-type when all the IBM
documentation for APIs refer to 4-byte integers as Binary(4) or Bin(4). I don't
know how many times I've seen 4B 0 in RPG code along with a "my call the this
API doesn't always work...".
-Bob Cozzi
www.i5PodCast.com
Ask your manager to watch i5 TV
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [
mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Joe Pluta
Sent: Monday, May 14, 2007 9:13 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Max length of a VARYING field
From: Barbara Morris
It's already possible to pass a varying parameter by reference to a
procedure that wants a different length, but you have to specify
OPTIONS(*VARSIZE). You would usually use operational descriptors to get
the maximum size; you can use %LEN to get the current size.
I have no doubt that operational descriptors would work, Barbara. I assumed
that Scott didn't want to use them based on his statement, "Remember, I'm
talking about reference parameters. All that's passed from caller to callee
is a pointer. No size, data type, etc is passed."
If Scott were to use operational descriptors and maybe a based variable, I
think all of his issues would be solved without having to explicitly code an
index length.
Joe
As an Amazon Associate we earn from qualifying purchases.