

CREATE VIEW TCSubSystemClasses AS 
  SELECT 
   a.*,
   f.adName AS adName2,
   f.subsystemDll AS subsystemDll1,
   f.viewCDLFiles AS viewCDLFiles1,
   f.label AS label2,
   f.contents AS contents2,
   k.adName AS adName3,
   k.attrMask AS attrMask1,
   k.cHppPassText,
   k.cCppPassText,
   k.sHppPassText,
   k.sCppPassText,
   k.label AS label3,
   k.contents AS contents3,
   k.adName1 AS adName4,
   k.attribType,
   k.attrTypeLen,
   k.attrMask1 AS attrMask2,
   k.methodNames,
   k.label1 AS label4,
   k.contents1 AS contents4,
   k.adName2 AS adName5,
   k.attribType1 AS attribType1,
   k.attrTypeLen1 AS attrTypeLen1,
   k.attrMask2 AS attrMask3,
   k.relRetClass,
   k.relSubsysName,
   k.invRelClassSbsysNm,
   k.relInvRel,
   k.relClass,
   k.minValue,
   k.maxValue,
   k.relCard,
   k.attribSrcTgt,
   k.label2 AS label5,
   k.contents2 AS contents5,
   k.adName3 AS adName6,
   k.methodRetType,
   k.methodParms,
   k.attrMask3 AS attrMask4,
   k.label3 AS label6,
   k.contents3 AS contents6,
   k.adName4 AS adName7,
   k.attribType2 AS attribType2,
   k.attrTypeLen2 AS attrTypeLen2,
   k.attrMask4 AS attrMask5,
   k.relRetClass1 AS relRetClass1,
   k.invRelClssSbsysNm1 AS invRelClssSbsysNm1,
   k.relInvRel1 AS relInvRel1,
   k.relClass1 AS relClass1,
   k.minValue1 AS minValue1,
   k.maxValue1 AS maxValue1,
   k.relCard1 AS relCard1,
   k.attribSrcTgt1 AS attribSrcTgt1,
   k.adName5 AS adName8,
   k.attribType3 AS attribType3,
   k.attrTypeLen3 AS attrTypeLen3,
   k.attrMask5 AS attrMask6,
   k.relRetClass2 AS relRetClass2,
   k.relSubsysName1 AS relSubsysName1,
   k.relInvRel2 AS relInvRel2,
   k.relClass2 AS relClass2,
   k.minValue2 AS minValue2,
   k.maxValue2 AS maxValue2,
   k.relCard2 AS relCard2,
   k.label7 AS label7,
   k.contents7 AS contents7,
   k.adName6 AS adName9,
   k.adName7 AS adName10,
   k.label4 AS label8,
   k.contents4 AS contents8,
   k.methodNames1 AS methodNames1,
   k.constraintMask,
   k.label5 AS label9,
   k.contents5 AS contents9,
   k.methodNames2 AS methodNames2,
   k.label6 AS label10,
   k.contents6 AS contents10,
   o.adName AS adName11,
   o.attrMask AS attrMask7,
   o.cHppPassText AS cHppPassText1,
   o.cCppPassText AS cCppPassText1,
   o.sHppPassText AS sHppPassText1,
   o.sCppPassText AS sCppPassText1,
   o.label AS label11,
   o.contents AS contents11,
   o.adName1 AS adName12,
   o.attribType AS attribType4,
   o.attrTypeLen AS attrTypeLen4,
   o.attrMask1 AS attrMask8,
   o.methodNames AS methodNames3,
   o.label1 AS label12,
   o.contents1 AS contents12,
   o.adName2 AS adName13,
   o.attribType1 AS attribType5,
   o.attrTypeLen1 AS attrTypeLen5,
   o.attrMask2 AS attrMask9,
   o.relRetClass AS relRetClass3,
   o.relSubsysName AS relSubsysName2,
   o.invRelClassSbsysNm AS invRelClssSbsysNm2,
   o.relInvRel AS relInvRel3,
   o.relClass AS relClass3,
   o.minValue AS minValue3,
   o.maxValue AS maxValue3,
   o.relCard AS relCard3,
   o.attribSrcTgt AS attribSrcTgt2,
   o.adName3 AS adName14,
   o.adName4 AS adName15,
   o.adName5 AS adName16,
   o.attribType2 AS attribType6,
   o.attrTypeLen2 AS attrTypeLen6,
   o.attrMask3 AS attrMask10,
   o.relRetClass1 AS relRetClass4,
   o.invRelClssSbsysNm1 AS invRelClssSbsysNm3,
   o.relInvRel1 AS relInvRel4,
   o.relClass1 AS relClass4,
   o.minValue1 AS minValue4,
   o.maxValue1 AS maxValue4,
   o.relCard1 AS relCard4,
   o.attribSrcTgt1 AS attribSrcTgt3,
   o.adName6 AS adName17,
   o.attribType3 AS attribType7,
   o.attrTypeLen3 AS attrTypeLen7,
   o.attrMask4 AS attrMask11,
   o.relRetClass2 AS relRetClass5,
   o.relSubsysName1 AS relSubsysName3,
   o.relInvRel2 AS relInvRel5,
   o.relClass2 AS relClass5,
   o.minValue2 AS minValue5,
   o.maxValue2 AS maxValue5,
   o.relCard2 AS relCard5,
   o.invRelClssSbsysNm2 AS invRelClssSbsysNm4,
   o.adName7 AS adName18,
   o.adName8 AS adName19,
   o.label2 AS label13,
   o.contents2 AS contents13,
   o.adName9 AS adName20,
   o.methodRetType AS methodRetType1,
   o.methodParms AS methodParms1,
   o.attrMask5 AS attrMask12,
   o.label3 AS label14,
   o.contents3 AS contents14,
   o.methodNames1 AS methodNames4,
   o.constraintMask AS constraintMask1,
   o.label4 AS label15,
   o.contents4 AS contents15,
   o.methodNames2 AS methodNames5,
   o.label5 AS label16,
   o.contents5 AS contents16
  FROM
    TCSubSystemClsssBs a
    INNER JOIN TCSubsystem_versin b ON b.OID=a.OID AND b.OVer=a.OVer
    LEFT OUTER JOIN ADLink_source c ON c.classAttr='TCSubsystem_version.pDependsOnSubs' AND
      c.sourceOID=b.OID AND c.sourceOVer=b.OVer
    LEFT OUTER JOIN adobjectFind d ON d.OID=c.relOID AND d.OVer=c.relOVer AND
       d.className='TCSubsysToSubsys' AND
       d.contextRelease=a.contextRelease AND d.contextName=a.contextName
    LEFT OUTER JOIN ADLink e ON e.OID=d.OID AND e.OVer=d.OVer
    LEFT OUTER JOIN TCSBYTMLSVEB f ON f.OID=e.adTarget AND f.OVer=e.OVer    
AND  f.contextRelease=a.contextRelease AND  f.contextName=a.contextName
    LEFT OUTER JOIN TCSubsystem_versin g ON g.OID=f.OID AND g.OVer=f.OVer
    LEFT OUTER JOIN ADLink_target h ON h.classAttr='TCSubsystem_version.pMetaClasses' AND
      h.targetOID=g.OID AND h.targetOVer=g.OVer
    LEFT OUTER JOIN adobjectFind i ON i.OID=h.relOID AND i.OVer=h.relOVer AND
       i.className='TCSubsysToMeta' AND
       i.contextRelease=a.contextRelease AND i.contextName=a.contextName
    LEFT OUTER JOIN ADLink j ON j.OID=i.OID AND j.OVer=i.OVer
    LEFT OUTER JOIN TCRELMETACLASSVIEW k ON k.OID=j.adSource AND k.OVer=j.OVer    
AND  k.contextRelease=a.contextRelease AND  k.contextName=a.contextName
    LEFT OUTER JOIN ADLink_target l ON l.classAttr='TCSubsystem_version.pMetaClasses' AND
      l.targetOID=g.OID AND l.targetOVer=g.OVer
    LEFT OUTER JOIN adobjectFind m ON m.OID=l.relOID AND m.OVer=l.relOVer AND
       m.className='TCSubsysToMeta' AND
       m.contextRelease=a.contextRelease AND m.contextName=a.contextName
    LEFT OUTER JOIN ADLink n ON n.OID=m.OID AND n.OVer=m.OVer
    LEFT OUTER JOIN TCMETACLASSVIEW o ON o.OID=n.adSource AND o.OVer=n.OVer    
AND  o.contextRelease=a.contextRelease AND  o.contextName=a.contextName;

CREATE VIEW TCSBYTMLSVE AS   -- TCSUBSYSTEMCLASSVIEW
  SELECT 
   a.*,
   f.adName AS adName1,
   f.attrMask,
   f.cHppPassText,
   f.cCppPassText,
   f.sHppPassText,
   f.sCppPassText,
   f.label AS label1,
   f.contents AS contents1,
   f.adName1 AS adName2,
   f.attribType,
   f.attrTypeLen,
   f.attrMask1 AS attrMask1,
   f.methodNames,
   f.label1 AS label2,
   f.contents1 AS contents2,
   f.adName2 AS adName3,
   f.attribType1 AS attribType1,
   f.attrTypeLen1 AS attrTypeLen1,
   f.attrMask2 AS attrMask2,
   f.relRetClass,
   f.relSubsysName,
   f.invRelClassSbsysNm,
   f.relInvRel,
   f.relClass,
   f.minValue,
   f.maxValue,
   f.relCard,
   f.attribSrcTgt,
   f.label2 AS label3,
   f.contents2 AS contents3,
   f.adName3 AS adName4,
   f.methodRetType,
   f.methodParms,
   f.attrMask3 AS attrMask3,
   f.label3 AS label4,
   f.contents3 AS contents4,
   f.adName4 AS adName5,
   f.attribType2 AS attribType2,
   f.attrTypeLen2 AS attrTypeLen2,
   f.attrMask4 AS attrMask4,
   f.relRetClass1 AS relRetClass1,
   f.invRelClssSbsysNm1 AS invRelClssSbsysNm1,
   f.relInvRel1 AS relInvRel1,
   f.relClass1 AS relClass1,
   f.minValue1 AS minValue1,
   f.maxValue1 AS maxValue1,
   f.relCard1 AS relCard1,
   f.attribSrcTgt1 AS attribSrcTgt1,
   f.adName5 AS adName6,
   f.attribType3 AS attribType3,
   f.attrTypeLen3 AS attrTypeLen3,
   f.attrMask5 AS attrMask5,
   f.relRetClass2 AS relRetClass2,
   f.relSubsysName1 AS relSubsysName1,
   f.relInvRel2 AS relInvRel2,
   f.relClass2 AS relClass2,
   f.minValue2 AS minValue2,
   f.maxValue2 AS maxValue2,
   f.relCard2 AS relCard2,
   f.label7 AS label5,
   f.contents7 AS contents5,
   f.adName6 AS adName7,
   f.adName7 AS adName8,
   f.label4 AS label6,
   f.contents4 AS contents6,
   f.methodNames1 AS methodNames1,
   f.constraintMask,
   f.label5 AS label7,
   f.contents5 AS contents7,
   f.methodNames2 AS methodNames2,
   f.label6 AS label8,
   f.contents6 AS contents8,
   j.adName AS adName9,
   j.attrMask AS attrMask6,
   j.cHppPassText AS cHppPassText1,
   j.cCppPassText AS cCppPassText1,
   j.sHppPassText AS sHppPassText1,
   j.sCppPassText AS sCppPassText1,
   j.label AS label9,
   j.contents AS contents9,
   j.adName1 AS adName10,
   j.attribType AS attribType4,
   j.attrTypeLen AS attrTypeLen4,
   j.attrMask1 AS attrMask7,
   j.methodNames AS methodNames3,
   j.label1 AS label10,
   j.contents1 AS contents10,
   j.adName2 AS adName11,
   j.attribType1 AS attribType5,
   j.attrTypeLen1 AS attrTypeLen5,
   j.attrMask2 AS attrMask8,
   j.relRetClass AS relRetClass3,
   j.relSubsysName AS relSubsysName2,
   j.invRelClassSbsysNm AS invRelClssSbsysNm2,
   j.relInvRel AS relInvRel3,
   j.relClass AS relClass3,
   j.minValue AS minValue3,
   j.maxValue AS maxValue3,
   j.relCard AS relCard3,
   j.attribSrcTgt AS attribSrcTgt2,
   j.adName3 AS adName12,
   j.adName4 AS adName13,
   j.adName5 AS adName14,
   j.attribType2 AS attribType6,
   j.attrTypeLen2 AS attrTypeLen6,
   j.attrMask3 AS attrMask9,
   j.relRetClass1 AS relRetClass4,
   j.invRelClssSbsysNm1 AS invRelClssSbsysNm3,
   j.relInvRel1 AS relInvRel4,
   j.relClass1 AS relClass4,
   j.minValue1 AS minValue4,
   j.maxValue1 AS maxValue4,
   j.relCard1 AS relCard4,
   j.attribSrcTgt1 AS attribSrcTgt3,
   j.adName6 AS adName15,
   j.attribType3 AS attribType7,
   j.attrTypeLen3 AS attrTypeLen7,
   j.attrMask4 AS attrMask10,
   j.relRetClass2 AS relRetClass5,
   j.relSubsysName1 AS relSubsysName3,
   j.relInvRel2 AS relInvRel5,
   j.relClass2 AS relClass5,
   j.minValue2 AS minValue5,
   j.maxValue2 AS maxValue5,
   j.relCard2 AS relCard5,
   j.invRelClssSbsysNm2 AS invRelClssSbsysNm4,
   j.adName7 AS adName16,
   j.adName8 AS adName17,
   j.label2 AS label11,
   j.contents2 AS contents11,
   j.adName9 AS adName18,
   j.methodRetType AS methodRetType1,
   j.methodParms AS methodParms1,
   j.attrMask5 AS attrMask11,
   j.label3 AS label12,
   j.contents3 AS contents12,
   j.methodNames1 AS methodNames4,
   j.constraintMask AS constraintMask1,
   j.label4 AS label13,
   j.contents4 AS contents13,
   j.methodNames2 AS methodNames5,
   j.label5 AS label14,
   j.contents5 AS contents14
  FROM
    TCSBYTMLSVEB a
    INNER JOIN TCSubsystem_versin b ON b.OID=a.OID AND b.OVer=a.OVer
    LEFT OUTER JOIN ADLink_target c ON c.classAttr='TCSubsystem_version.pMetaClasses' AND
      c.targetOID=b.OID AND c.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind d ON d.OID=c.relOID AND d.OVer=c.relOVer AND
       d.className='TCSubsysToMeta' AND
       d.contextRelease=a.contextRelease AND d.contextName=a.contextName
    LEFT OUTER JOIN ADLink e ON e.OID=d.OID AND e.OVer=d.OVer
    LEFT OUTER JOIN TCRELMETACLASSVIEW f ON f.OID=e.adSource AND f.OVer=e.OVer    
AND  f.contextRelease=a.contextRelease AND  f.contextName=a.contextName
    LEFT OUTER JOIN ADLink_target g ON g.classAttr='TCSubsystem_version.pMetaClasses' AND
      g.targetOID=b.OID AND g.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind h ON h.OID=g.relOID AND h.OVer=g.relOVer AND
       h.className='TCSubsysToMeta' AND
       h.contextRelease=a.contextRelease AND h.contextName=a.contextName
    LEFT OUTER JOIN ADLink i ON i.OID=h.OID AND i.OVer=h.OVer
    LEFT OUTER JOIN TCMETACLASSVIEW j ON j.OID=i.adSource AND j.OVer=i.OVer    
AND  j.contextRelease=a.contextRelease AND  j.contextName=a.contextName;