Hi community,
I'm trying to get rid of all those "magic numbers" in our code and therefor create name constants wherever i can.
To make the named constants unique i put e.g. the db2-table-name into the constants name.
Sometimes magic numbers are used in several tables and i thought about the following (just a cut-to-minimal sample):
dcl 1 tablex_sex,
2 male char(1) value('m'),
2 female char(1) value('f'),
2 undefined char(1) value('x');
dcl tabley_sex like tablex_sex;
if x = tabley_sex.male then ... << compiler error "IBM1766I-Value for tabley_sex.male must be evaluated before its first use"
I think i understand that there are reasons for named constants and "like" not working well together, but i see no real "showstopper".
Is there a way to make this or at least something similar work?
br johann
[edit 2015.06.09] fixed typo in "dcl tabley_sex ..."
woecki