When to compile COBOL - DB2 program



IBM's flagship relational database management system

When to compile COBOL - DB2 program

Postby Tamilarasan » Wed Sep 21, 2016 8:19 pm

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.
Tamilarasan
 
Posts: 4
Joined: Wed Sep 21, 2016 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: When to compile COBOL - DB2 program

Postby prino » Wed Sep 21, 2016 9:12 pm

That's why you never should use

SELECT * ...


If you have not all is OK.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 641
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 29 times

Re: When to compile COBOL - DB2 program

Postby pranav283 » Thu Sep 22, 2016 3:16 pm

@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!
pranav283
 
Posts: 47
Joined: Sat Aug 30, 2014 3:52 pm
Has thanked: 2 times
Been thanked: 0 time

Re: When to compile COBOL - DB2 program

Postby Tamilarasan » Thu Sep 22, 2016 3:22 pm

@ pranav-I haven't explicitly mentioned the new column name (As it is not required) in the COBOL program.
Tamilarasan
 
Posts: 4
Joined: Wed Sep 21, 2016 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: When to compile COBOL - DB2 program

Postby pranav283 » Thu Sep 22, 2016 3:37 pm

Ok. Have you coded
SELECT *
in the program ? As some programmers do code this while declaring a cursor.
pranav283
 
Posts: 47
Joined: Sat Aug 30, 2014 3:52 pm
Has thanked: 2 times
Been thanked: 0 time

Re: When to compile COBOL - DB2 program

Postby Tamilarasan » Thu Sep 22, 2016 3:40 pm

No. i didn't.
Tamilarasan
 
Posts: 4
Joined: Wed Sep 21, 2016 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: When to compile COBOL - DB2 program

Postby pranav283 » Thu Sep 22, 2016 3:47 pm

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.
pranav283
 
Posts: 47
Joined: Sat Aug 30, 2014 3:52 pm
Has thanked: 2 times
Been thanked: 0 time

Re: When to compile COBOL - DB2 program

Postby Tamilarasan » Thu Sep 22, 2016 3:52 pm

Thank you Pranav :)
Tamilarasan
 
Posts: 4
Joined: Wed Sep 21, 2016 8:13 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post