IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

RExx code to find the unused variables in COBOL prog


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Apr 10, 2011 6:33 pm
Reply with quote

Hi Nic,

I guess most of the confusion is that my example is, logically, using the storage area allocated by the 01-level group item which has no referenced subordinate items.

The rest of the confusion is the specificity of the terms "elementary", "group" and "subordinate".

The compiler behaves logically, but the documentation denies that that behaviour is possible, because it provides only a limited description of how data can be defined in the DATA DIVISION. The documentation is wrong. According to the documentation my group level-01 should be deleted, even though it is redefined.

You are right that the debate has to be won. Otherwise, what is the point of debating?

So, fortunately for you, there is not so much to check on. This is the statement I rely on "In addition, level-01 group items are discarded if none of their subordinate items are referenced."

You need "level-01 group items" and "subordinate items". If you are worried you can't find enough on "subordinate items" check out CORRESPONDING (as in MOVE CORRESPONDING, ADD CORRESPONDING etc).

If you can convince me that either of these two things I have interpreted incorrectly, then I will conceed defeat. Otherwise, you add to your store of Cobol knowledge, and you concede defeat (this can be achieved implicitly).

"level-01 group item" - In the DATA DIVISION, an 01 which has no picture clause on its definition, but which contains items (elementary or group) at higher level numbers. This definition of mine would cause some confusion because if the 01 does not have a PICTURE and has no subordinate items then it causes a compile error. So, really, it is a "valid" 01 which has no picture clause on its definition.

"subordinate items" - In the DATA DIVISON, the things which make up a group item, they can be either elementary or a group item with a level number higher than the group item they are subordinate to.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Mon Apr 11, 2011 1:37 am
Reply with quote

For what it's worth, which may not be much, as far as I am concerned the data element "REDEFINES-SUBORDINATE-ITEM" is, indeed, subordinate to the group "GROUP-DATA-WITH-SUBORDINATE" by virtue of the fact that it is subordinate to a group element that redefines that group.

Mathematically, given the following formulae as being true

A=B,
C=A, and
C=D

One could state with absolute certainty that

B=A (symmetric postulate of equality - if A=B then B=A),
A=C (symmetric postulate of equality - if C=A then A=C),
D=C (symmetric postulate of equality - if C=D then D=C),
A=D (transitive postulate of equality - if A=C and C=D then A=D),
B=C (transitive postulate of equality - if B=A and A=C then B=C), and
B=D (transitive postulate of equality - if B=A and A=C and C=D then B=D)

Similarly, given the fact that each of the problem group elements contain one and only one subordinate data element it follows that

GROUP=DATA=WITH-SUBORDINATE = SUBORDINATE-ITEM (A=B),
REDEFINES-GROUP = GROUP-DATA-WITH-SUBORDINATE (C=A), and
REDEFINES-GROUP = REDEFINES-SUBORDINATE-ITEM (C=D)

from which it logically follows that

GROUP-DATA-WITH-SUBORDINATE = REDEFINES-SUBORDINATE-ITEM (A=D), etc.

Thus, any reference to REDEFINES-SUBORDINATE-ITEM (D) is implicitly a reference to GROUP-DATA-WITH-SUBORDINATE (A).

If you increase the number of subordinate data elements in either the main or redefined groups, there remains an overlap of elements that would still lead to some level of mathematical equality between a subordinate element of one of the groups to the other group - hence any element subordinate to one group is also subordinate to the redefines/redefined group.

My two cents. YMMV.

Ron
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Apr 11, 2011 4:07 am
Reply with quote

PeterHolland wrote:
And why dont you share that with us?

Because it is only usable if you have the Smartedit editor installed.

I have not heard of anyone here in the forum that uses Smartedit, let alone a forum that features a topic list that includes (mainframe) Cobol editor software.

I don't want to drop source/script code in some random thread unless specifically usable or asked for in the topic.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 11, 2011 4:27 am
Reply with quote

I agree that, logically, the redefines has a necessary relationship to the item it is redefining.

This is the way the programmer/team doing the optimisation code have approached it (OK, that's a lot to say from one test, but at least so far it seems reasonable to say).

For a similar reason, I would expect both 01-levels to be removed by the OPT(FULL) if there are no references, in the Procedure Division, to any of the items in either 01-level.

However, I do have a problem with the item in the redefines then being regarded as "subordinate".

From the Programmer's Guide

Quote:

Using data items and group items

Related data items can be parts of a hierarchical data structure. A data item that does not have subordinate data items is called an elementary item. A data item that is composed of one or more subordinate data items is called a group item.

A record can be either an elementary item or a group item. A group item can be either an alphanumeric group item or a national group item.


So a group item consists of subordinates. A subordinate item may itself be a group, or it may be elemental. A subordinate item is part of a group item. Everything that makes up a group item is subordinate to that group item. Everything that makes up an 01-level group item is a subordinate item of the 01-level group.

This is how every reference (let's leave the OPT(FULL) for the moment) in the Programmer's Guide and Language Reference use the term "subordinate item".

If you think about it, the usage has to be consistent, otherwise, if the same phrase were to mean different things in different parts of the manuals, understanding the manuals would be less clear. OK, I can get stronger than that. The manuals would be rubbish, and unusable (assuming the same process applied to several phrases - if they don't always mean the same thing, then they mean nothing).

Now, what I am saying is that the programmer/team are different from the writer/team who updated the manual. Who knows what the writer/team were working from, but, assuming that "subordinate item" means the same as it does throughout the Cobol manuals, then the description of OPT(FULL) is incorrect. We have an example where what the documentation says should be removed is not removed (and is correctly not removed as far as logic is concerned) and another example which we can't tell from the documentation whether or not it would be removed (although, logically, it should).

I'm afraid we can't just get away with "I feel subordinate should mean this". But even if we did just allow it to mean something different in that paragraph in the manual, we still wouldn't know whether the second example (where nothing is referenced in the Procedure Division, but the redefines is still there in the Data Division) would be removed, or not.

It is a documentation error. Anyone agree? Why are we carrying this out in the CLIST & rexx forum?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Apr 11, 2011 12:05 pm
Reply with quote

no, i do not agree that it is a documentation error.

one of the problems of IBM manuals is that they expect you to remember the info on page 1 as you read page 2.

in the E-cobol programmers guide in Section 8.1.4.1 Optimization it simply says:
Enterprise COBOL for z/OS V4.2 Programming Guide: 2.4.40 wrote:
Discard unreferenced data items from the DATA DIVISION, and suppress generation of code to initialize these data items to their VALUE clauses. (The optimizer takes this action only when you use the FULL suboption.)
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 11, 2011 1:14 pm
Reply with quote

dbzTHEdinosauer wrote:
no, i do not agree that it is a documentation error.

one of the problems of IBM manuals is that they expect you to remember the info on page 1 as you read page 2.

in the E-cobol programmers guide in Section 8.1.4.1 Optimization it simply says:
Enterprise COBOL for z/OS V4.2 Programming Guide: 2.4.40 wrote:
Discard unreferenced data items from the DATA DIVISION, and suppress generation of code to initialize these data items to their VALUE clauses. (The optimizer takes this action only when you use the FULL suboption.)


OK, so from the quote we started off with "The FULL suboption requests that... 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."

We're talking about the same thing then. This quote is from "Enterprise COBOL for z/OS Programming Guide Version 4 Release 2"... er... kind of similar. PDF version. Document no SC23-8529-01. Perhaps it is already updated. One way to "fix" the manual is to take out the bits that are wrong. The paragraph you quote is expanded to give a more exact description in the quote from the PDF. Giving the more exact description then made it wrong (by ignoring the affects of redefines). If yours is more up-to-date, then maybe they've already fixed it.

I agree that there is a "technique" to reading IBM manuals. I disagree that that technique involves understanding which of more than one concept for a particular phrase you need to use on this particular page or that.

If your manual, by yours I mean "theirs" but the one you quoted, is more up-to-date, then I'm happy that the text giving me concern is no longer a problem (because it isn't there).
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Apr 11, 2011 7:50 pm
Reply with quote

No answer in the latest manual reference, they are both from different parts of the same manual! I've started an thread in the Cobol forum, finally.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top