Help with a query. 
Author Message
 Help with a query.

Folks,

  I am wondering if I can write a query to answer following question.

  I am trying to find dead code in our source code repository.
  Example:
1
#ifdef A
2
#ifndef A
3               <- this is dead code.
#endif A
4
#endif A
5

   or

1
#ifndef A
2
#ifdef A
3               <- this is dead code.
#endif A
4
#endif A
5

 Everytime someone checks in a file, it runs through a command that reads the
file and updates database. I have a table defined as follows:


# db2 "select * from gblcode.modcontrol fetch first 10 rows only"

SRC_NUM     LINE_NUM    MOD_NUMBER           SWITCH          LEVEL
----------- ----------- -------------------- --------------- ------
       1001          10 H5231                IFDEF                1
       1001         473 H5231                ENDIF-I              1
       1002          89 H4448                IFDEF                1
       1002          93 H4737B               IFDEF                2
       1002          95 H4737B               ELSE-I               2
       1002          97 H4737B               ENDIF-IE             2
       1002          99 H4448                ELSE-I               1
       1002         101 H4448                ENDIF-IE             1
       1002         140 H4449                IFDEF                1
       1002         143 H4449                ENDIF-I              1
       1002         240 H4583                IFNDEF               1
       1002         257 H4583                ENDIF-N              1

I want to select SRC_NUM, MOD_NUMBER where each file (SRC_NUM) there is a
IFDEF and IFNDEF for same MOD_NUMBER at different LEVEL.

How would I write a query for it?

I was going to write a query that will give me everything sorted by src_num,
line_num and run the output through a perl script to get the answer.

Thanks.

--
Hemant Shah                           /"\  ASCII ribbon campaign

                                       X     against HTML mail
TO REPLY, REMOVE NoJunkMail           / \      and postings      
FROM MY E-MAIL ADDRESS.          
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.



Sun, 31 Jul 2005 07:10:29 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Please help...INSERT INTO QUERY using a query def as the source

2. Help: Need help writing a query to Microsoft SMS database using ISQL

3. Need help with SQL query

4. Help with a query

5. Help with complex query in SQL2000

6. Need help with a query...

7. Need help writing a query

8. Need help on combining queries...

9. REQ: Help with SQL query on SQL 7

10. Need Help - SQL 7.0 Query Timeout

11. HELP in SELECT query for item that NOT EXIST

12. Help with delete query


 
Powered by phpBB® Forum Software