IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 queries from Program Load


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gaurav.rajvanshi

New User


Joined: 08 Jul 2010
Posts: 23
Location: Mainframe World

PostPosted: Mon Jul 23, 2012 12:15 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Mon Jul 23, 2012 1:33 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 23, 2012 2:28 am
Reply with quote

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
View user's profile Send private message
gaurav.rajvanshi

New User


Joined: 08 Jul 2010
Posts: 23
Location: Mainframe World

PostPosted: Mon Jul 23, 2012 10:28 am
Reply with quote

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
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon Jul 23, 2012 12:19 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jul 23, 2012 5:44 pm
Reply with quote

Did you consider browsing a loadlib member to see what is there?
Back to top
View user's profile Send private message
gaurav.rajvanshi

New User


Joined: 08 Jul 2010
Posts: 23
Location: Mainframe World

PostPosted: Mon Jul 23, 2012 6:07 pm
Reply with quote

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
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Mon Jul 23, 2012 9:39 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Mon Jul 23, 2012 11:18 pm
Reply with quote

Hello,

Suggest you tell the "third person" that you need the source for the SQL . . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 24, 2012 12:08 am
Reply with quote

i thought that it was odd
that someone wanted some specific sql
but did not know what the sql was.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Tue Jul 24, 2012 3:26 am
Reply with quote

Perhaps the TS is trying to install a module from outside his installation. That might explain the lack of source code.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Jul 24, 2012 7:46 am
Reply with quote

Quote:
A third person has provided me with a load module only (Don't know where and when he compiled his program).
Yup icon_smile.gif
Back to top
View user's profile Send private message
gaurav.rajvanshi

New User


Joined: 08 Jul 2010
Posts: 23
Location: Mainframe World

PostPosted: Tue Jul 24, 2012 10:14 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Tue Jul 24, 2012 11:29 am
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jul 24, 2012 6:13 pm
Reply with quote

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"... icon_exclaim.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Tue Jul 24, 2012 6:29 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Jul 24, 2012 8:04 pm
Reply with quote

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
View user's profile Send private message
gaurav.rajvanshi

New User


Joined: 08 Jul 2010
Posts: 23
Location: Mainframe World

PostPosted: Tue Jul 24, 2012 8:16 pm
Reply with quote

Thank You all...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts Unload and Load ISPF Table TSO/ISPF 4
No new posts Using API Gateway from CICS program CICS 0
No new posts Load new table with Old unload - DB2 DB2 6
No new posts How to load to DB2 with column level ... DB2 6
Search our Forums:

Back to Top