Shall i use redefine when renaming of variables is required



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

Shall i use redefine when renaming of variables is required

Postby gouravar » Sun Jul 02, 2017 10:04 pm

Hi,

I am working on a task to change the variable names of a copybook which has around 300 variables. These variables are then used in approx 40 programs. The reason behind changing the name of variables is to give them meaningful names. Out of these 40 programs, my application is the owner of 10 programs.

Now if we simply change variables I have to change and compile all 40 programs.

Does this will be a good approach to redefining all 300 variables with their name and same pic clause. 10 programs which come under my application will be changed to use the new variable names and other 30 programs will be recompiled as it is.

Please share your thoughts on same. Also, please let me know if I am missing something to consider.

Thanks in advance.
gouravar
 
Posts: 7
Joined: Tue Jun 12, 2012 10:36 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Shall i use redefine when renaming of variables is requi

Postby Robert Sample » Mon Jul 03, 2017 7:11 pm

Or, you could update the copy book and place comment line(s) before or after each variable giving what it is used for. Then you don't have to recompile a single program.

If you start changing variable names in the copy book, you need to recompile EVERY program using the copy book -- period. Otherwise, there could be issues (such as duplicate variable names) that are not discovered until a production job blows up at 3 AM and the compile to fix the problem then blows up for the copy book issues.

In general, the fewer changes made to production programs, the better. And changing variable names just to make them meaningful is rarely a good use of anyone's time, and it adds potential problems to boot. Avoid this type of busywork whenever you can.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Shall i use redefine when renaming of variables is requi

Postby Prat » Wed Aug 29, 2018 2:35 pm

[quote="Robert Sample"]Or, you could update the copy book and place comment line(s) before or after each variable giving what it is used for. Then you don't have to recompile a single program.

If you start changing variable names in the copy book, you need to recompile EVERY program using the copy book "

First of all thanks everyone for assisting so many people around the globe with their doubts. I am very new to this forum.

Hi Robert,

One doubt I have. In your response you mentioned that if we update the copybook then no need to recompile all the programs, later you mentioned if you change the variable names in the copybook you need to recompile. If we change the variable names means copybook is updated...right? Doesn't seems both are same. Please correct me if wrong.
Prat
 
Posts: 1
Joined: Wed Aug 29, 2018 2:26 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Shall i use redefine when renaming of variables is requi

Postby enrico-sorichetti » Wed Aug 29, 2018 3:29 pm

changing a comment will not impact the application logic

but from a formal point of view - and the source control system point of view - the copybook has been changed

so to update it You would have to go thru all the source control system shebang ,

checkout, change , promote from testing up to production

and if Your system has been properly setup it will force the recompilation of ALL the program using the copybook
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
Prat (Wed Aug 29, 2018 3:36 pm)
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Shall i use redefine when renaming of variables is requi

Postby Robert Sample » Wed Aug 29, 2018 4:40 pm

Sometimes a copybook is set up with FILLER at the end of to allow for changes. In such a case, if a new variable (or variables) uses some of this FILLER (and the length of the FILLER is reduced to match) so the length of the data defined in the copybook does not change, then only those programs using the new variable(s) HAVE to be recompiled. Programs that don't use the new variable(s) should be recompiled to guarantee no variable name conflicts exist, but they don't have to be recompiled when the copybook is changed.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Shall i use redefine when renaming of variables is requi

Postby enrico-sorichetti » Wed Aug 29, 2018 6:57 pm

I beg to disagreee :)

a change request might need a bit of paperwork
and when starting and later consolidating a change ( usually at the promote to production stage )
a reference to the change management request might required
and the promote log ( source changes, programs involved, rebinds done )
might be part of the change request closing documentation

not compiling everything will introduce a hole in the audit log when compiling/rebuilding something later on
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Shall i use redefine when renaming of variables is requi

Postby gcastillo » Thu Oct 04, 2018 6:48 pm

If the primary reason is to have more meaningful var names modifying the actual copybook is not an option I would take.

Most of You have pointed out the main reason.... At the end of the line, all the affected programs must be recompiled... just to have everything in sync.... which is even more important if you are using a change control manager, as it has already been pointed out.

My point... Programs using the actual ugly names should not be affected in ANY way.. or be recompiled... new ones, on the other hand, may be able to use the new "fancy" variable names...

This is what I Would do...

Define a NEW copybook, inside of which, I would place the COPY instruction just to..... You guess it.. have the old definitions logically in my NEW copybook, technically I will be nesting Copy Commands, which is allowed by the cobol standard.

Right after that, I REDEFINE whatever I want... Ideally the higher level variable name.. and make every nice variable name and format that I want to.


New programs shall use the "NEW" copy book.

Old programs, whenever the get updated may do the same.... or keep using the "OLD". You may even update a few of them without a full recompile....

Personalty I would just keep the old ugly copybook if there is not a ........ heavier reason to change it....
gcastillo
 
Posts: 2
Joined: Wed Jun 01, 2016 6:33 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post