home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / datatl25.zip / DCTDSGN.Z / EWSQDEU.QRY < prev    next >
Text File  |  1997-09-11  |  4KB  |  133 lines

  1. #NAME#
  2. DA_DataElementUsage
  3. #DESCRIPTION#
  4. The DataElementUsage impact analysis query returns the names of all the objects which directly use a Shareable Data Element and may be impacted by changes to its data specification.
  5.  
  6. View type:  DAQDataElementUsage
  7.  
  8. Modifications:
  9. The query uses a SQL UNION clause to provide a more compact result table.  The result table contains five columns: the data element name, what kind of object the row represents, the object which uses the data element and, if necessary, objects which contain the related objects.
  10. If you are not interested in a particular type of object, you should delete the subselect from the query.
  11.  
  12. In order to change the search criteria, you must change it for each subselect statement in the UNION. Change the search criteria of the dataElement using the = (equals), IN or LIKE elements in the SQL WHERE clause.
  13.  
  14.    
  15.  
  16. #MODIFIED#
  17.  
  18. #VERSION#
  19.  
  20. #SQL STATEMENT#
  21. -- Data element used by columns in relational tables
  22. SELECT DISTINCT
  23.   d.dataElement as dataElement,
  24.   'Relational Column' as relatedType,
  25.   d.ColumnName as relatedObject,
  26.   t.tableDefinition as container1,
  27.   '' as container2
  28. FROM OUTER
  29.   DAQDataElementUsage d,
  30.   (d.inTableDefinition) t,
  31.   PartView p
  32. WHERE
  33.   d.dataElement like '<>%' AND
  34.   (t.tableDefinition = p.baseName AND
  35.    p.partType='DSRTableDefinition')
  36. UNION
  37. -- Data element used by IMS fields which are not shared
  38. -- with a data structure
  39. SELECT DISTINCT
  40.   d.dataElement as dataElement,
  41.   'IMS Field' as relatedType,
  42.   d.imsField as relatedObject,
  43.   d.imsSegment as container1,
  44.   db.rootDBDName as container2
  45. FROM OUTER
  46.   DAQDataElementUsage d,
  47.   (d.inDBD) db,
  48.   PartView p
  49. WHERE
  50.   d.dataElement like '<>%' AND
  51.   (db.rootDBDName = p.baseName AND
  52.    p.partType='DSDBD')
  53. UNION
  54. -- Data element used by IMS fields which are shared with
  55. -- a data structure
  56. SELECT DISTINCT
  57.   d.dataElement as dataElement,
  58.   'IMS Field' as relatedType,
  59.   d.imsFieldS as relatedObject,
  60.   d.imsSegmentS as container1,
  61.   db.rootDBDName as container2
  62. FROM OUTER
  63.   DAQDataElementUsage d,
  64.   (d.inDBDs) db,
  65.   PartView p
  66. WHERE
  67.   d.dataElement like '<>%' AND
  68.   (db.rootDBDName = p.baseName AND
  69.    p.partType='DSDBD')
  70. UNION
  71. -- Data element used by a data structure
  72. SELECT DISTINCT
  73.   d.dataElement as dataElement,
  74.   'Shareable Data Structure' as relatedType,
  75.   s.dataStructure as relatedObject, 
  76.   ' ' as container1,
  77.   ' ' as container2
  78. FROM OUTER
  79.   DAQDataElementUsage d,
  80.   (d.inDataStructure) s,
  81.   PartView p
  82. WHERE
  83.   d.dataElement like '<>%' AND
  84.   (s.dataStructure = p.baseName AND
  85.   p.partType='DSDataStructure')    
  86. UNION
  87. -- Data element used directly by an included source definition
  88. SELECT DISTINCT
  89.   d.dataElement as dataElement,
  90.   'Included Source' as relatedType,
  91.   i.includedSourceDefinition as relatedObject,
  92.   ' ' as container1,
  93.   ' ' as container2
  94. FROM OUTER
  95.   DAQDataElementUsage d,
  96.   (d.inIncludedSource) i,
  97.   PartView p
  98. WHERE
  99.   d.dataElement like '<>%' AND
  100.   (i.includedSourceDefinition = p.baseName AND
  101.    p.partType='DSIncludedSourceDef')  
  102. UNION
  103. -- Data element used by a VisualAge Generator data item
  104. SELECT DISTINCT
  105.   d.dataElement as dataElement,
  106.   'VA Generator Data Item' as relatedType,
  107.   d.vagDataItem as relatedObject,
  108.   ' ' as container1,
  109.   ' ' as container2
  110. FROM OUTER
  111.   DAQDataElementUsage d,
  112.   PartView p
  113. WHERE
  114.   d.dataElement like '<>%' AND
  115.   (d.vagDataItem = p.baseName AND
  116.    p.partType='VGDataItem')  
  117. UNION
  118. -- Data element used by a data model
  119. -- (because of an error in the view type, 
  120. --  this subselect uses a different view type)
  121. SELECT DISTINCT
  122.   m.adName1 as dataElement,
  123.   'Data Model' as relatedType,
  124.   m.adName as relatedObject,
  125.   ' ' as container1,
  126.   ' ' as container2
  127. FROM OUTER
  128.   cdmModelUsesDataElmnView m
  129. WHERE
  130.   m.adName1 like '<>%'
  131. ORDER BY
  132.   1,2,3;
  133.