View previous topic :: View next topic
|
Author |
Message |
gaurav.rajvanshi
New User
Joined: 08 Jul 2010 Posts: 23 Location: Mainframe World
|
|
|
|
Hello All,
Can we get the SQL queries used in a COBOL-DB2 program if we just have its load module for reference.
Thank You... |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
I am not sur if I understand what you mean! Do you mean eye-balling the load module to see the SQL queries in plain English. They are not even in plain English when they get to the compiler. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you can find the SQL in the DBRM library (Database Request Module library) which is:- populated by the db2 pre-compiler in the pre-compiler step
- or populated by the co-processer in the compiler step - e-cobol compiles
A read of the the general db2 overview in the db2 manuals would have provided you with this information. |
|
Back to top |
|
|
gaurav.rajvanshi
New User
Joined: 08 Jul 2010 Posts: 23 Location: Mainframe World
|
|
|
|
Thanks dbZ for your reply but I wasn't able to find the same in the manuals also.
Please let me try to make my question more understandable...
A third person has provided me with a load module only (Don't know where and when he compiled his program). I want to get the queries used in the program. I just have the load module for reference which I can also use in my JCL. Do we have any ways for finding the queries by looking into the DB2 catalogs or anything else after the job completes.
Any valuable reply would be appreciated... |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
assuming this is static SQL : if you can run the program, you also have a package and thus a stmt in SYSIBM.SYSPACKSTMT |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Did you consider browsing a loadlib member to see what is there? |
|
Back to top |
|
|
gaurav.rajvanshi
New User
Joined: 08 Jul 2010 Posts: 23 Location: Mainframe World
|
|
|
|
Craq Giegerich wrote: |
Did you consider browsing a loadlib member to see what is there? |
Yes Craq,
a load can always give you some information like program compilation date or the other programs linked to it |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
The load module won't tell you much about the SQL text that it is processing. If you look at a compile listing you will see that all of the embedded SQL statements are commented out by the precompiler. The Cobol compiler does not store comments in the object code that it generates, so there is no way that it will end up in the load module.
As others have stated, the only place, besides the original source code, that you can find the SQL text is in the DBRMLIB member and/or SYSPACKSTMT. That's assuming that the program contains only static SQL.
If it contains dynamic SQL, you might get lucky and see some literals in the load module that give a clue as to what it is doing. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you tell the "third person" that you need the source for the SQL . . . |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
i thought that it was odd
that someone wanted some specific sql
but did not know what the sql was. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Perhaps the TS is trying to install a module from outside his installation. That might explain the lack of source code. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Quote: |
A third person has provided me with a load module only (Don't know where and when he compiled his program). |
Yup |
|
Back to top |
|
|
gaurav.rajvanshi
New User
Joined: 08 Jul 2010 Posts: 23 Location: Mainframe World
|
|
|
|
Thanks GuyC, Thanks Don for your valuable replies
and thanks dick/dbz for doing your best to keep the post interesting by putting in your funny comments. They really don't help... |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Your original post states
Quote: |
just have its load module for reference |
so the answer to your query would appear to be 'No'. If you have the DBRM then the answer would appear to be 'Yes' but you seem not to have this. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
gaurav.rajvanshi wrote: |
and thanks dick/dbz for doing your best to keep the post interesting by putting in your funny comments. They really don't help... |
Considering the fact you just asked "How can I hack into a third person program?",
you are lucky to have received only "funny comments"... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Quote: |
Perhaps the TS is trying to install a module from outside his installation. That might explain the lack of source code. |
the load module alone is not enough!
we are just wasting time on a poor description of the requirement and environment |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
and thanks dick/dbz for doing your best to keep the post interesting . . . |
Possibly meant for me, possibly not. My comments were not intended to be "interesting". You need to have the source available for more than just seeing the DB2 queries.
As no one else has yet mentioned this yet - you should be sure you have written permission to install unknown/untested/whatever load modules on your system. Most places will not allow "neat stuff" to be installed on their systems. Even with the source, many organizations do not permit this.
I suspect you can trust whoever/whatever on your home pc, but not on your employer's or client's system. |
|
Back to top |
|
|
gaurav.rajvanshi
New User
Joined: 08 Jul 2010 Posts: 23 Location: Mainframe World
|
|
|
|
Thank You all... |
|
Back to top |
|
|
|