Page 1 of 1

When to compile COBOL - DB2 program

PostPosted: Wed Sep 21, 2016 8:19 pm
by Tamilarasan
Hi,
I have introduced new column in my Db2 table. But that new column is not used by the COBOL program, still do i need to compile the COBOL program? What will happen if i don't do? Please help me to understand.

Re: When to compile COBOL - DB2 program

PostPosted: Wed Sep 21, 2016 9:12 pm
by prino
That's why you never should use

SELECT * ...


If you have not all is OK.

Re: When to compile COBOL - DB2 program

PostPosted: Thu Sep 22, 2016 3:16 pm
by pranav283
@Tamilrasan,

What do you mean by that
But that new column is not used by the COBOL program
Are you saying that you haven't explicitly coded the column name/host variable or are you saying that the COBOL program, while running, will not access this column by any means, even as what @Prino pointed out.

However, I would suggest it is not a good practice to not re-compile the programs whenever there is a change in table schema.

What will happen if i don't do

That will depend on the criteria that I mentioned above. So, lets say if the COBOL program is not accessing this column, then there would be no effect on the results.
But, if the COBOL program is accessing the column (in ways that you don't know yet), then you can expect a BIND error (SQL -805) or a Timestamp mismatch error (SQL -818). Reason - the consistency token, or what we call as timestamp will not be same in the PACKAGE (which is part of the PLAN) as that in the LOAD module of your COBOL program.
I hope it helps!

Re: When to compile COBOL - DB2 program

PostPosted: Thu Sep 22, 2016 3:22 pm
by Tamilarasan
@ pranav-I haven't explicitly mentioned the new column name (As it is not required) in the COBOL program.

Re: When to compile COBOL - DB2 program

PostPosted: Thu Sep 22, 2016 3:37 pm
by pranav283
Ok. Have you coded
SELECT *
in the program ? As some programmers do code this while declaring a cursor.

Re: When to compile COBOL - DB2 program

PostPosted: Thu Sep 22, 2016 3:40 pm
by Tamilarasan
No. i didn't.

Re: When to compile COBOL - DB2 program

PostPosted: Thu Sep 22, 2016 3:47 pm
by pranav283
Then things shall be fine even if you don't recompile the program. However, it is not a good practice to not recompile a program in such cases.

Re: When to compile COBOL - DB2 program

PostPosted: Thu Sep 22, 2016 3:52 pm
by Tamilarasan
Thank you Pranav :)