|
Nelson, I see what you're getting at, you use the constants when evaluating the contents of the field, and having those constants defined right next to the field. My only beef with it is that i believe your goal would be better served describing the constants outside of the DS and commenting the DS if desired. by making them part of the DS, someone who wanted to modify the program and hadn't read this thread or that particular section of the documentation/un-documentation, the following 'facts' might be assumed... 1. somehow, the constants ARE inforcing the integrity of the field, much like a DDS values keyword? 2. the constants ARE part of the data structure, and actually take up space in the DS buffer? both of which are not true, because: ONLY due to the fact that it is a constant, rather than a variable, it is described to the program OUTSIDE the data structure, having absolutely nothing to do with the DS proper. This, to me, is very confusing and could send someone on a wild goose chase trying to track down why the ds doesn't look like he/she thought is should. listing the valid values here doesn't enforce the integrity of the data, any more than a comment would. I agree with Barbara that the bug, if it is a bug, shouldn't be 'fixed', to keep existing programs compilable, (maybe adding a 10 or 20 level warning message might do the trick?) but imo, using an 'undocumented feature' in this manner strikes me as a bit of obfuscation, rather than alumination... have a great weekend all... rick ----original message------- Richard, Here's a ds in which all the allowable values for the field Col_Fld_Type are listed right under it's definition, even though it is part of a larger data structure. Doesn't change anything except the readability or self-documentation of the ds. With proper indenting (which doesn't come across too well), it is very evident what the constants are used for: D ds_Sfl_Layout DS D Column_Array DIM(400) D Col_SQLDASeq 5I 0 OVERLAY(Column_Array:1) D Col_Disp_Seq 5I 0 OVERLAY(Column_Array:*NEXT) D Col_Incl_Flg N OVERLAY(Column_Array:*NEXT) D Col_Null_Flg N OVERLAY(Column_Array:*NEXT) D Col_Fld_Type 10A OVERLAY(Column_Array:*NEXT) D cstBinary C CONST('*BINARY') D cstChar C CONST('*CHAR') D cstDate C CONST('*DATE') D cstPacked C CONST('*PACKED') <snip>
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.