|
GA, To check to see if the length was not set by the compiler would be as difficult as checking to see if this was a divide by zero: /free z=x/y; /end-free y could have been set in the program, could have been passed in as a parameter, could have been read in from a file. Same story with the length. Would you be happy with a warning message RNF.... The MOVE opcode is about to be deprecated. Find a better alternative :-) Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin G Armour <garmour400r@xxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 08/28/2003 12:12 PM Please respond to RPG programming on the AS400 / iSeries To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc: Fax to: Subject: Re: VARLEN dds field in RPG-IV Excellent explanation, Hans! And right along the lines that I was thinking of. Still, I wonder (but don't doubt your word) why the compiler can't "see" that the field-length prefix isn't being set. Maybe easier, if it isn't even being referenced? I told my colleagues not to lose too many brain cells on this; just use the EVAL and life will be good. Thanks again! GA --- Hans Boldt <boldt@xxxxxxxxxx> wrote: <snip> > I think this is largely a case of "working as designed". > > To summarise the rules: When using varying length variables within > the traditional fixed-form calcs (not the expression calcs), a > varying length variable works the same as a fixed length field > defined with the current length. That is, if the current length of a > char varying field is 10 (regardless of the declared maximum > length), then the operation works the same as is the field were > fixed length 10 chars. > > Of course, if the current length is 0, then there's not really an > analogue in the fixed length case. But we're not going to make any > change to the compiler that might possibly regress users, and so > that behavior ain't gonna change. > > Why this way? The rules for char result on the old fixed-form calcs > get in the way of meaningful rules for varying length variables. For > example, for many fixed-form opcodes, char results are generally > unpadded and right adjusted. Just how exactly do you right-adjust a > value in a varying length result? We settled on the current rules > for fixed-form calcs since you get the results you generally expect > in the expression calcs anyways, and we wanted to keep the rules > consistent for all fixed-form calcs. > > Regarding a warning (sev 10) message, I can't think of any warning > that would specifically warn about this situation. The compiler > generally can't know that a varying length variable never gets its > length set. > > Cheers! Hans __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.