Remove redefines from cobol copybooks



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Remove redefines from cobol copybooks

Postby nikesh_rai » Wed Feb 27, 2013 9:40 pm

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
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Remove redefines from cobol copybooks

Postby Akatsukami » Wed Feb 27, 2013 10:16 pm

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?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Remove redefines from cobol copybooks

Postby prino » Wed Feb 27, 2013 10:23 pm

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?
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Remove redefines from cobol copybooks

Postby nikesh_rai » Wed Feb 27, 2013 10:58 pm

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.. :)
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Remove redefines from cobol copybooks

Postby nikesh_rai » Wed Feb 27, 2013 11:08 pm

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...
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Remove redefines from cobol copybooks

Postby Akatsukami » Wed Feb 27, 2013 11:20 pm

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:
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Remove redefines from cobol copybooks

Postby nikesh_rai » Wed Feb 27, 2013 11:25 pm

Yes.. thats correct.. but what about WS-BAR.. :cry:
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Remove redefines from cobol copybooks

Postby Akatsukami » Wed Feb 27, 2013 11:43 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Remove redefines from cobol copybooks

Postby Robert Sample » Thu Feb 28, 2013 12:03 am

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).
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Remove redefines from cobol copybooks

Postby Akatsukami » Thu Feb 28, 2013 1:34 am

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post