Page 1 of 1

Shall i use redefine when renaming of variables is required

PostPosted: Sun Jul 02, 2017 10:04 pm
by gouravar
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.

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

PostPosted: Mon Jul 03, 2017 7:11 pm
by 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 -- 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.

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

PostPosted: Wed Aug 29, 2018 2:35 pm
by Prat
[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.

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

PostPosted: Wed Aug 29, 2018 3:29 pm
by enrico-sorichetti
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

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

PostPosted: Wed Aug 29, 2018 4:40 pm
by Robert Sample
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.

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

PostPosted: Wed Aug 29, 2018 6:57 pm
by enrico-sorichetti
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

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

PostPosted: Thu Oct 04, 2018 6:48 pm
by gcastillo
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....