Page 1 of 2

Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 8:48 pm
by letmelive
I have a requirement where I need to extract all sql statements in cobol source code. I have 'n' no of cobol source libraries and I need to scan each member inside the libraries for sql statements and extract those statements into a newly created PDS under the same member name.

I'm not familiar with REXX and so I've started looking into REXX manuals to come up with the REXX code on my own. But considering the time available, I'm searching web hoping that the required REXX code might already be there somewhere. I came across this thread http://ibmmainframes.com/about28179.html and unfortunately could not see the code. Can anyone help me to get this code?

Thank you.

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 8:56 pm
by MrSpock
There is code posted in that link you provided. It's an attachment you'll have to download.

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 9:10 pm
by enrico-sorichetti
thats the syndrome of NOT downloadable attachments :geek:

anyway I just looked at it ...

IMO badly written, not documented,
the awkward variable names make difficult to follow the logic

not even thoroughly tested
( the main path falls straight don a called procedure )
 call Initialization
 call mainProcessing
 
 Initialization:


too muck work for somebody who agrees on
I'm not familiar with REXX ...

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 9:17 pm
by BillyBoyo
Do you have the compile listings for the programs in question? The compiler has done all the complex stuff, and you strip out from there...?

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 9:23 pm
by enrico-sorichetti
why not try to extract them from SYSIBM.SYSSTMT ?
worth looking at as an alternative !

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 9:36 pm
by letmelive
Hi Billyboyo,
Do you mean precompile o/p, the DBRMLIB? Those are not in readable format.. Is there a way to convert it?

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 9:39 pm
by BillyBoyo
No, I mean the listing from the final compile of the Cobol program.

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 9:46 pm
by Akatsukami
BillyBoyo wrote:No, I mean the listing from the final compile of the Cobol program.

Would that not give heesh only the calls to the DB2 routines? Or am I mistaken in thinking that what heesh wants is the text between the EXEC-SQL and END-EXEC delimiters?

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 10:04 pm
by letmelive
Akatsukami,
Your interpretation is correct.. I would need those line of code between EXEC SQL and END EXEC..
BillyBoyo,
As akatsukami said will it not contain the equivalent calls to DB2 routine? Curse my ignorance. how can I get the SQL statements from the compile listing?

Re: Extract SQL statements from COBOL source code using REXX

PostPosted: Mon Oct 22, 2012 10:09 pm
by letmelive
Enrico,
why not try to extract them from SYSIBM.SYSSTMT ?
worth looking at as an alternative !

Thanks for your suggestion. I am considering it. But the unicode format bothers me. I have started looking into type casting stuff.. Hope I learn to convert it into readable format..