×
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.
Ultimately, this discussion can go a number of different ways based on how the data structures are being used and whatnot. I prefer to use INZ in all (non-file) Data Structure definitions (or at least those with numeric subfields). A stand-alone variable will, by default, initialize, so in forcing all subfields in a data structure to initialize, they will have valid default values instead of potential junk values that can kill a program.
I can understand the argument of not accessing a value if it hasn't been loaded, but maybe you need to access the default values when lacking values that were loaded from another source. In a language where the default value is generally blank or zero, you need to be able to accommodate for that already, so why not with DS subfields? If you prefer to have a program die when accessing a field that hasn't been loaded, then I suggest basing all your variables & DS's and not assigning an address until you load the field (tic).
That said, it's a pet peeve of mine when I see INZ (without a parameter) on any variable field as it seems extraneous to me. Note: I have no issue with explicitly initializing the default value (i.e. INZ(0)) in cases where the parameter has a particular meaning.
Kurt Anderson
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Christen, Duane
Sent: Monday, October 19, 2009 9:54 AM
To: RPG programming on the IBM i / System i
Subject: INZ in all D-specs : Was Problem with moving Data Structures
Bruce wrote: "... In fact, it is good practice to use INZ in all D-specs unless you have a good reason not to."
I completely disagree, personally I believe it is bad practice to use INZ. IMO if you are accessing a variable/DS before you have written data to it your logic is incorrect and needs to be addressed. There are exceptions of course, in my experience these occur most often with date/time/timestamps and constant values where the compiler will not allow you to use a CONST variable.
Any other thoughts?
Duane Christen
--
[
http://www.paetec.com/eSignature/My_PAETEC_signature_r1_c1.gif]
[
http://www.paetec.com/eSignature/My_PAETEC_signature_r1_c2.gif]
[
http://www.paetec.com/eSignature/My_PAETEC_signature_r2_c1.gif]<
http://www.paetec.com/>
Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx<mailto:Duane.Christen@xxxxxxxxxx>
[
http://www.paetec.com/eSignature/My_PAETEC_signature_r3_c1.gif]
As an Amazon Associate we earn from qualifying purchases.