|
<Hans> Can we change the compiler to give an error message? Sure, it's doable. But when you get a successful compile, do you ever bother to look at the compile listing and check the severity 10 diags? </Hans> With the Java compiler it is the equivalent to a 20 or 30 severity level (or at least it wont compile through). I think that would be warranted even if you are doing a assignment on that field before an IF statement because the next guy might not be thinking that through. Call me ignorant but I guess I never knew that you had to initialize a data structure or a subfield to get valid data in numeric fields. I just assumed it would be like stand alone fields which _do_ get initialized to zero. One more thing. The documentation placement of this is pretty bad. It is only located in the section of the RPG Reference where the INZ keyword is described and not in the data structure area. Even if it was duplicate information I think it would be warranted to put it in both places. Aaron Bartell -----Original Message----- From: Hans Boldt [mailto:boldt@xxxxxxxxxx] Sent: Saturday, August 16, 2003 8:43 AM To: rpg400-l@xxxxxxxxxxxx Subject: RE: Varying - Inz mandatory? Bartell, Aaron L. (TC) wrote: >>If you don't initialize a "varying" field, I think it's length is set to > zero so the error makes since. > Actually it is just blank space - x'40' until I Inz it, then it is x'F0'. > > It would be nice if it would initialize to zero for you or have the > compiler > notify you that it was not initialized. For example the Java compiler > gives the following message for the following code: > > int count; > for (int i = 0; count > i; i++){ > System.out.println("Hi"); > } > > Compile error: variable count may not have been initialized. This is consistent with behavior you've experienced before with uninitialized decimal numeric subfields. As already noted, by default, a data structure is initialized to all blanks, hex 40's. If you want subfields initialized to something other than hex 40's, code the INZ keyword either on the DS definition, or on the subfield definition. Can we change the compiler to give an error message? Sure, it's doable. But when you get a successful compile, do you ever bother to look at the compile listing and check the severity 10 diags? Cheers! Hans _______________________________________________ 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.