Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
There has been a discussion in the CLIST & rexx forum which has swerved into a discussion of the documentation of OPTIMIZE(FULL) in the Enterprise Cobol Programmers Guide.
Maybe time to move it into here, I thought.
This is from the Enterprise COBOL for z/OS Programming Guide Version 4 Release 2 SC23-8529-01 manual:
Quote:
The FULL suboption requests that, in addition to the optimizations performed with OPT(STD), the compiler discard unreferenced data items from the DATA DIVISION and suppress generation of code to initialize these data items to the values in their VALUE clauses. When OPT(FULL) is in effect, all unreferenced level-77 items and elementary level-01 items are discarded. In addition, level-01 group items are discarded if none of their subordinate items are referenced. The deleted items are shown in the listing. If the MAP option is in effect, a BL number of XXXXX in the data map information indicates that the data item was discarded.
The part which is causing me to treat this as a documentation error is:
"In addition, level-01 group items are discarded if none of their subordinate items are referenced."
So, Robert Sample kindly ran a little test program with a group 01-level with one lower level elementary item. The group 01-level was then redefined, again containing a lower level elementary item. That second elementary item was referenced in the procedure division.
OPT(FULL) did not delete the unreferenced (except by the redefines) level-01 group item. Correctly, but not as documented (I argue).
So, is it a documentation error (as I argue) or not? It seems pretty clear to me from the above, but I'm having trouble convincing anyone :-)
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
I don't think IBM is clear on what "reference" means. If it means any subordinate item or redefined subordinate item then the dcoumentation as quoted is correct -- but they need to add clarification as to what "reference" refers to; if it doesn't mean any subordinate item or redefined subordinate item then the documentation quoted needs revision.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Yet, same manual
Quote:
You can code the CORRESPONDING phrase in a MOVE statement to move subordinate elementary items from one group item to the identically named corresponding subordinate elementary items in another group item:
This will not move any subordinate items that happen to be the object of a redefines. I can take every reference to subordinate items (group or elementary) from the manuals to make the same point. Everywhere else in the manuals, it does not mean "just stick in the redefines item if you feel like it".
As I have said, I agree with you that there is a logical relationship between redefines subject and object. What I'm saying is that nowhere else in the manual does "subordinate item" of any sort include an "implicit" subordinate item from a redefines. I dont' see why, suddenly, OPT(FULL) should be read in that way, even though it behaves in that way.
The quote you posted in the other forum earlier, is exactly the sort of thing I think you were referring to about reading IBM manuals. What it said was correct, but if you want to see exactly what it does, you have to try it out yourself.
All my adult life a "subordinate data item" has, as far as I'm concerned, been all the things that make up the 01-level. I have never seen anything in a Cobol manual to make me even think about questioing this. So, when I read the original quote my first thought was "they can't mean that". Maybe in these days of things being "relative", it is all OK in the end? "subordinate data item" can mean what we feel it should mean at the time, one thing for CORRESPONDING, one thing for OPT(FULL), something else for, I don't know, everyone chose their favourite? :-)
As to Robert's point, I don't like the idea of mucking around with what "reference" means any more than "subordinate data item" :-) And you're saying they should change the docs for reference, if that is what they mean, else they should change the docs.