Extract SQL statements from COBOL source code using REXX



IBM's Command List programming language & Restructured Extended Executor

Extract SQL statements from COBOL source code using REXX

Postby letmelive » Mon Oct 22, 2012 8:48 pm

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.
letmelive
 
Posts: 20
Joined: Thu Oct 04, 2012 1:27 am
Has thanked: 6 times
Been thanked: 0 time

Re: Extract SQL statements from COBOL source code using REXX

 

Re: Extract SQL statements from COBOL source code using REXX

Postby MrSpock » Mon Oct 22, 2012 8:56 pm

There is code posted in that link you provided. It's an attachment you'll have to download.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: Extract SQL statements from COBOL source code using REXX

Postby enrico-sorichetti » Mon Oct 22, 2012 9:10 pm

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 ...
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2648
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 132 times

Re: Extract SQL statements from COBOL source code using REXX

Postby BillyBoyo » Mon Oct 22, 2012 9:17 pm

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...?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Extract SQL statements from COBOL source code using REXX

Postby enrico-sorichetti » Mon Oct 22, 2012 9:23 pm

why not try to extract them from SYSIBM.SYSSTMT ?
worth looking at as an alternative !
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2648
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 132 times

Re: Extract SQL statements from COBOL source code using REXX

Postby letmelive » Mon Oct 22, 2012 9:36 pm

Hi Billyboyo,
Do you mean precompile o/p, the DBRMLIB? Those are not in readable format.. Is there a way to convert it?
letmelive
 
Posts: 20
Joined: Thu Oct 04, 2012 1:27 am
Has thanked: 6 times
Been thanked: 0 time

Re: Extract SQL statements from COBOL source code using REXX

Postby BillyBoyo » Mon Oct 22, 2012 9:39 pm

No, I mean the listing from the final compile of the Cobol program.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Extract SQL statements from COBOL source code using REXX

Postby Akatsukami » Mon Oct 22, 2012 9:46 pm

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?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1054
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Extract SQL statements from COBOL source code using REXX

Postby letmelive » Mon Oct 22, 2012 10:04 pm

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?
letmelive
 
Posts: 20
Joined: Thu Oct 04, 2012 1:27 am
Has thanked: 6 times
Been thanked: 0 time

Re: Extract SQL statements from COBOL source code using REXX

Postby letmelive » Mon Oct 22, 2012 10:09 pm

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..
letmelive
 
Posts: 20
Joined: Thu Oct 04, 2012 1:27 am
Has thanked: 6 times
Been thanked: 0 time

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post