MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

String Handling in COBOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
ravi.alpha
Beginner


Joined: 31 Mar 2009
Posts: 18
Topics: 7

PostPosted: Mon Apr 06, 2009 12:20 am    Post subject: String Handling in COBOL Reply with quote

I want to parse the below SQL code using Cobol program.

I have below SQL in a flat file and I want read the below SQL and put each column name into an array declared in COBOL similarly I want to put all host variable (: H: H) into another array declared in Cobol.

Once I populate these column names into array I want to compare each with respective host variable if it is
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Apr 06, 2009 6:20 am    Post subject: Reply with quote

what is your goal?
since you have :H, I assume you are trying to parse DBRM's.
again, what is your goal?
having a null indicator is dependent upon either
the results of columnar/scalar functions and sub selects
or if the column is defined as nullable in the table/view declaration.

since the number of SELECT/INTO objects can vary, I would suggest using indexing or reference modification to extract your objects.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
ravi.alpha
Beginner


Joined: 31 Mar 2009
Posts: 18
Topics: 7

PostPosted: Mon Apr 06, 2009 12:14 pm    Post subject: Reply with quote

The goal is to find out all the columns which are not using Null indicators.

I have list of columns which can allow nulls from Sysibm.syscolumns. I want to filter all the DBRMS to find out which all application are impacted.

I have all the DBRMS downloaded into one files and now I want to parse each select statement and put column name in one array and host variable in another array.

I am also thinking of using Index but not sure of the exact logic. If you know the best way pls suggest me and provide me the logic
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Apr 06, 2009 2:48 pm    Post subject: Reply with quote

The reason i suggested indexing/reference modification is that I wrote a COBOL DBRM parser using UNSTRING. Not knowing how many objects to allow for (each select has x number of INTO's), required a continual loop in the UNSTRING logic. was not a fast as indexing/ref mod.

I was reading all DBRM's which meant I had a mix of SELECTs/INSERTs/DECLARE Tables, CURSORS/DELETEs, FETCHs, .....

Instead of investing time writing something that will work, I would suggest:

you can identify the modules that need to 'fixed' by
  1. ripping thru TABLE DECLAREs - searchfor NULL
  2. x all the NOT NULL
  3. use the IDX parm on the search to have the copybook/or module name on everyline
  4. that will give you a list of TABLES
  5. search the DBRMs for 'DECLARE TABLE <tablename> searchfor in batch allows you more than 1000 search items

That will be your module list. Then you can go back to the original SQL (module) and on a one by one basis modify the SQL. You will have to add logic in your module to handle null indictors anyway.

not an elegant solution but it is easier and faster to debug you searchfor logic than to write/debug a program that rips thru the DBRMs and compare to columns in syscolumns - which you will need to qualify each column with the table name.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
ravi.alpha
Beginner


Joined: 31 Mar 2009
Posts: 18
Topics: 7

PostPosted: Mon Apr 06, 2009 11:50 pm    Post subject: Reply with quote

ripping thru TABLE DECLAREs - searchfor NULL
x all the NOT NULL
use the IDX parm on the search to have the copybook/or module name on everyline
that will give you a list of TABLES
search the DBRMs for 'DECLARE TABLE <tablename> searchfor in batch allows you more than 1000 search items

I am not very much clear on this approch, could you please explain me bit more.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Apr 07, 2009 1:44 am    Post subject: Reply with quote

use the facilities of Search for, ispf option 3.1?.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
ravi.alpha
Beginner


Joined: 31 Mar 2009
Posts: 18
Topics: 7

PostPosted: Mon Apr 13, 2009 4:34 am    Post subject: Reply with quote

Thanks Dick Brenholtz.

After all the try... I have decided to move on to REXX.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group