Page 1 of 2

Remove redefines from cobol copybooks

PostPosted: Wed Feb 27, 2013 9:40 pm
by nikesh_rai
Hi,

There is a small requirement where I need to remove the redefines clause from COBOL copybooks. I did it manually, but when I checked the file with the new layout, invalid values are showing for the fields which was redefined earlier. I know the reason why it is so.. but is there any solution for this.. is there anything extra I need to do with my cobol program or copybook, so that it will display the proper value of fields... please suggest me


Thanks
Nikesh

Re: Remove redefines from cobol copybooks

PostPosted: Wed Feb 27, 2013 10:16 pm
by Akatsukami
Let me see if I understand this. You had a copybook which looked like
01  WS-STUFF.
  05  WS-FOO                   PIC X(5).
  05  WS-BAR  REDEFINES WS-FOO PIC 9(9) COMP-3.

You deleted WS-BAR; now noting that WS-FOO displays
  îÌæ
13579
2468C

you want to know how to cause it to display 123456789?

Re: Remove redefines from cobol copybooks

PostPosted: Wed Feb 27, 2013 10:23 pm
by prino
nikesh_rai wrote:There is a small requirement where I need to remove the redefines clause from COBOL copybooks.

Which PHB has come up with such a nonsensical requirement? Another scam to skim the customer?

Re: Remove redefines from cobol copybooks

PostPosted: Wed Feb 27, 2013 10:58 pm
by nikesh_rai
Which PHB has come up with such a nonsensical requirement? Another scam to skim the customer?


Even I was surprised, but you never know.. any thing can happen at any time.. specially with Software Engineer and if he is working on Mainframe.. god only can save him.. :)

Re: Remove redefines from cobol copybooks

PostPosted: Wed Feb 27, 2013 11:08 pm
by nikesh_rai
Hi Akatsukami,

Not exactly...

for example:

01  WS-STUFF.
  05  WS-FOO                   PIC X(5).
  05  WS-BAR  REDEFINES WS-FOO PIC 9(9) COMP-3.


now if WS-FOO have value "NIKES" and I have rmoved the redefines clause from WS-BAR.. it should not show INVALID value with WS-BAR
the value of WS-BAR should be either Blank or it should have some value...

Re: Remove redefines from cobol copybooks

PostPosted: Wed Feb 27, 2013 11:20 pm
by Akatsukami
nikesh_rai wrote:Hi Akatsukami,

Not exactly...

for example:

01  WS-STUFF.
  05  WS-FOO                   PIC X(5).
  05  WS-BAR  REDEFINES WS-FOO PIC 9(9) COMP-3.


now if WS-FOO have value "NIKES" and I have rmoved the redefines clause from WS-BAR.. it should not show INVALID value with WS-BAR
the value of WS-BAR should be either Blank or it should have some value...

You realize that by so doing you have created a new variable and changed the length of WS-STUFF from 5 bytes to 10? :shock:

Re: Remove redefines from cobol copybooks

PostPosted: Wed Feb 27, 2013 11:25 pm
by nikesh_rai
Yes.. thats correct.. but what about WS-BAR.. :cry:

Re: Remove redefines from cobol copybooks

PostPosted: Wed Feb 27, 2013 11:43 pm
by Akatsukami
WS-BR is the new variable; previouisly it was an alias of WS-FOO.

If you really mean to change the length of WS-STUFF, add a VALUE clause to the definition of WS-BAR. If not, delete the definition of WS-BAR altogether. If you don't know what should be done, demand an answer of your team lead/project lead/delivery manager.

Re: Remove redefines from cobol copybooks

PostPosted: Thu Feb 28, 2013 12:03 am
by Robert Sample
now if WS-FOO have value "NIKES" and I have rmoved the redefines clause from WS-BAR.. it should not show INVALID value with WS-BAR
the value of WS-BAR should be either Blank or it should have some value...
Not necessarily ... where did you assign a value to WS-BAR? If you did not assign a value, then the data in WS-BAR will depend upon your site options and could be LOW-VALUES or SPACES or anything else.

This sounds like a pretend "requirement" to create billable hours; REDEFINES has been a part of COBOL for well over 50 years and there has never been a reason to remove REDEFINES from a program (and often some good reasons to ADD them to a program).

Re: Remove redefines from cobol copybooks

PostPosted: Thu Feb 28, 2013 1:34 am
by Akatsukami
Robert Sample wrote:This sounds like a pretend "requirement" to create billable hours; REDEFINES has been a part of COBOL for well over 50 years and there has never been a reason to remove REDEFINES from a program (and often some good reasons to ADD them to a program).

More than that; it sounds like something thought (if I may use the word in this context) up by some gormless manager who doesn't realize that he's radically changing, and probably breaking, every program that uses one or more of those copybooks.