World ® ’1 6 CA IDMS™ Version 19.0 SQL Enhancements for Modernization Dave Ross, Senior Principal Product Owner CA Technologies MFX103S MAINFRAME AND WORKLOAD AUTOMATION
World®’16
CAIDMS™Version19.0SQLEnhancementsforModernizationDaveRoss,SeniorPrincipalProductOwnerCATechnologies
MFX103S
MAINFRAMEANDWORKLOADAUTOMATION
2 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
©2016CA.Allrightsreserved.Alltrademarksreferencedhereinbelongtotheirrespectivecompanies.
Thecontentprovidedinthis CAWorld2016presentationisintendedforinformationalpurposesonlyanddoesnotformanytypeofwarranty. The informationprovidedbyaCApartnerand/orCAcustomerhasnotbeenreviewedforaccuracybyCA.
ForInformationalPurposesOnlyTermsofthisPresentation
3 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
Abstract
CustomersneedtoleveragetheirinvestmentinCAIDMS™tocreatenewapplicationsbasedonservicesintheapplicationeconomy,andtheyneedtodothiswithcurrenttechnologiesanddeveloperskillsets. ThissessionshowshowSQLenhancementsinCAIDMS19.0improvestandardscompliance,developerproductivity,andcompatibilitywiththirdpartytoolsandapplications. TheSQLvirtualforeignkeyfeatureenablesdeveloperstousestandardSQLtoaccessandupdatenetworkdatabaseswithouttheneedtousenetworkDMLortableprocedures. EnhancementstoSQLDDLenableuserstodefinedatabasesusingstandardDDLcompatiblewithotherdatabases.
DavidRoss
CATechnologiesSr.PrincipalProductOwner,CAIDMS
4 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
Agenda
SQLVIRTUALFOREIGNKEYS
ISOSTANDARDSQLCONSTRAINTDDL
1
2
5 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
CAIDMSSQLRelationaltoNetworkMapping
••IdenticallynamedTable
••EquivalentRow
••AutomaticallyrenamedColumn
••PartialmappingReferentialconstraint
••ViaSCHEMARecorddefinition
••EquivalentRecordoccurrence
••ExceptODO,redefines,…Element
••LackofforeignkeysSet
SQL Network
6 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
RelationaltoNetworkMappingTechniques
Syntaxextensions
Views
Procedures••Tableprocedures••Calledprocedures
Foreignkeys••Referentialsets
7 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
ComparisonofMappingTechniques
SQLExtensions No No No No Limited
Views Yes No No No Limited
TableProcedures Yes Yes No No Encapsulate
ReferentialSets Yes No Yes Maybe Referentialconstraints
StandardSQL Newprograms ExposesSetsApplicationchanges
Restructure
8 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
VirtualForeignKeys
ExposeSetsasReferentialConstraints••Queries••Updates
BasedonROWID••Virtualprimarykey=ROWID••Virtualforeignkey=FKEY_<set_name>
DefineonSQLSchemadefinition
VisiblethroughJDBCandODBCmetadata
Enableaccessforcommontoolsandapplicationframeworks
UseSQLtoaccessandmaintainnetworkdatabasesfromJava
9 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
VirtualForeignKeyBenefits
§ UsestandardSQLtoaccessandupdateCAIDMS– RemovesINSERTandUPDATElimitations– CapabilitieslikenetworkDML– WriteapplicationsusingJava,.NET,andpopularframeworks– NospecialCAIDMSSQLsyntax
§ Easytoimplement– Nodatabasechanges– Nochangestonetworkdefinitions– Noneedfortableprocedures
10 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
VirtualPrimaryKey
§ PseudocolumnROWID– Uniquelyidentifiesarow– Availableforeverytable– Notnullable
§ DatatypeROWID– Length8bytes– ContainsDBKEYandPageInfo– Valuenotpersistentandthusnotatrueprimarykey– Relationaloperatorsupportextended(<,>,<=,>=)
11 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
VirtualForeignKey
§ PseudocolumnFKEY_setname– “setname”istheSQLtransformednameofset– ValueisROWIDofownerofset-nameorNULLifnomembership– Availableforeverysetinwhichrecordismember– Alwaysappearsnullable,butcannotsettoNULLforMAsets
§ DatatypeROWID– Mustbe8bytes– containsDBKEYandPageInfoofsetowner
12 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
VirtualForeignKeys
§ VirtualforeignkeyscanbereferencedinSQLstatementslikeauser-definedcolumn
§ Includedinlistof“all”columns(SELECT*)
§ IncludedinINSERTandUPDATEdefaultcolumnlist– Whencolumnlistisexcluded– Columnorder:
§ Userdefinedcolumns§ ROWID§ Virtualforeignkeysinalphabeticalorder
13 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
EnablingVirtualForeignKeys
§ “Create”virtualkeyswithSQLschemadefinitioncreateschemaEMPSCHM
fornonsql schemaEMPDICT.EMPSCHMversion100withvirtualkeys
§ ROWIDandvirtualforeignkeysbecomevisible– SELECT*– INSERTcolumnlistwhenlistisomitted– UPDATEcolumnlistwhenlistisomitted
§ “Remove”virtualkeysalterschemaEMPSCHMwithoutvirtualkeys
14 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
EMPSCHMWithVirtualForeignKeys
DEPT-EMPLOYEE EMP-EXPERTISE
DEPT-ID-0410
DEPARTMENT
ORG-DEMO-REGION
410 F 120 CALC
FKEY_EMP_EXPERTISEFKEY_DEPT_EMPLOYEE
EMP-ID-0415
EMPLOYEE
EMP-DEMO-REGION
415 F 120 CALCEMP-EXPERTISE
EXPERTISE
EMP-DEMO-REGION
400 F 16 VIA
ROWID ROWID ROWID
15 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
SELECTExamples
§ ObtainDEPARTMENTdataofanEMPLOYEEselect*fromDEPARTMENTwhereROWID=(selectFKEY_DEPT_EMPLOYEEfromEMPLOYEEwhere EMP_ID=1001)
§ JoinDEPARTMENTandEMPLOYEEselectd.*,e.*fromDEPARTMENTd,EMPLOYEEewhered.ROWID =e.FKEY_DEPT_EMPLOYEE
16 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
MoreSELECTExamples
§ SelectallEXPERTISErecordsforanEMPLOYEEselect*fromEXPERTISEwhereFKEY_EMP_EXPERTISE=
(selectROWIDfromEMPLOYEEwhereEMP_ID=1001)
§ ShowallDEPARTMENTsincludingthosewithoutEMPLOYEEsselectd.*,e.*fromDEPARTMENTdleftjoinEMPLOYEEeond.ROWID =e.FKEY_DEPT_EMPLOYEE
17 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
INSERTUsingVirtualKeys
§ Usetoestablishsetmembership– SetvirtualforeignkeycolumntoownerROWIDorNULL– Setmembershipoptionsdefineintegrityconstraints– MAsetdisallowsNULLvaluedvirtualforeignkey
§ UseROWIDtosuggestDBKEYforaDIRECTrecord– Defaultsto-1onSTORE(firstavailableDBKEYinpagerangeused)– IgnoredifrecordlocationmodeisnotDIRECT
18 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
INSERTUsingVirtualKeys
§ Useofscalar-query-expressioninVALUESclause– NewR19.0featureforINSERTstatementsforallSQLschemas– Withvirtualkeys,allowsINSERTtocontainqueriesthatretrievethe
virtualforeignkeyvaluestobesetintheinsertedrow
§ Supportforvirtualkeysinquery-specification– AlternativetoVALUESclauseonINSERT– QueryresultmusthavesamenumberofcolumnsasnamedinINSERT
statement– Ifnocolumnsnamed,numberofcolumnsmustmatchthetotal
numberofcolumns,includingROWIDandallVFKs
19 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
INSERTExamplesVALUESClauseWithColumnList
insertintoEMPLOYEE(EMP_ID,EMP_FNAME,EMP_LNAME,FKEY_DEPT_EMPLOYEE,FKEY_OFFICE_EMPLOYEE)
values(976,’SEBASTIAN’,’VOLLMER’,(selectROWIDfromDEPARTMENTwhereDEPT_ID=9003),(selectROWIDfromOFFICEwhereOFFICE_CODE='002'))
20 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
INSERTExamplesVALUESClauseWithoutColumnList
insertintoEMPLOYEEvalues
(976,’SEBASTIAN’,’VOLLMER’,NULL,(selectROWIDfromDEPARTMENTwhereDEPT_ID=9003),(selectROWIDfromOFFICEwhereOFFICE_CODE='002'))
§ EMPLOYEEcolumnsareEMP_ID,EMP_FNAME,EMP_LNAME,ROWID,FKEY_DEPT_EMPLOYEE,FKEY_OFFICE_EMPLOYEE
21 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
INSERTExamplesSpecifyingVirtualKeysUsingQuery-specification
insertintoEMPOSITION(START_YEAR,FKEY_EMP_EMPOSITION,FKEY_JOB_EMPOSITION)
select2015,E.ROWID,J.ROWIDfromEMPLOYEEE,JOBJwhereE.EMP_ID=23andJ.JOB_ID=2025
22 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
UPDATE
§ VirtualForeignKeyscanbespecifiedinSETclause
§ EquivalenttoCONNECT/DISCONNECTDMLverbs
§ Allowedforsetswithmembershipoptions– OPTIONAL(OA/OM)– MANDATORYMANUAL(MM)whenrecordnotyetconnectedtoset
§ SETFKEY_setnamevaluesallowed– NULL– ROWIDofowneroccurrenceofsetname– ROWIDofmemberoccurrenceofsetname
23 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
UPDATEExamples
§ DisconnectingtheEMPLOYEEfromtheDEPT-EMPLsetupdateEMPLOYEEsetFKEY_DEPT_EMPL=NULL
whereEMP_ID=23
§ EMPLOYEEconnectedtoDEPARTMENT4000updateEMPLOYEEsetFKEY_DEPT_EMPL=
(selectROWIDfromDEPARTMENTwhereDEPT_ID=4000)whereEMP_ID=23
24 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
DELETE
§ Usevirtualkeycolumnsthesameasuser-definedcolumns
deletefromEMPLOYEEwhereFKEY_DEPT_EMPL=
(selectROWIDfromDEPARTMENTwhereDEPT_NAME=‘Sales’)
25 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
DiscoveringVirtualKeys
§ JDBCandODBCmetadataAPIsexposevirtualkeys
§ java.sql.DatabaseMetaData interfacemethods– getPrimaryKeys– getExportedKeys– getImportedKeys– getCrossReference
§ ODBCAPIfunctions– SQLPrimaryKeys– SQLForeignKeys
26 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
DiscoveringNetworkRelationships
27 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
VirtualKeysComparedtoOtherMappingTechniques
SQLExtensions No No No No Limited
Views Yes No No No Limited
TableProcedures Yes Yes No No Encapsulate
ReferentialSets Yes No Yes Maybe Referentialconstraints
VirtualKeys Yes No No No Referentialconstraints
StandardSQL Newprograms ExposesSetsApplicationchanges
Restructure
28 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
SQLDDLEnhancements
§ ISOStandardConstraintDefinitionDDL– CREATETABLE– ALTERTABLE– Uniqueconstraints– PrimaryKeyconstraints– Referentialconstraints
§ Improvesintegrationwithframeworksandtools
§ DISPLAYTABLE
29 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
DefiningUNIQUEConstraints
§ Auniqueconstraintisspecifiedbycoding– UNIQUEonacolumndefinition– UNIQUE(<column-names>)inthecolumnlist
§ Aconstraintmaybenamed– CONSTRAINT<name>– Precedestheconstraintdefinition– Nameisgeneratedifnotnamed
§ Morethanoneuniqueconstraintmaybedefined
30 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
UNIQUEConstraintExample
createtableABC.TABLE1(COL1CHAR(8)unique,COL2CHAR(8),constraintCON1unique(COL2,COL1))
31 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
DefiningPrimaryKeyConstraints
§ APrimaryKeyconstraintisspecifiedbycoding– PRIMARYKEYonacolumndefinition– PRIMARYKEY(<column-names>)inthecolumnlist
§ Aconstraintmaybenamed– CONSTRAINT<name>– Precedestheconstraintdefinition– Nameisgeneratedifnotnamed
§ ONEPrimaryKeyconstraintpertable
32 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
PrimaryKeyConstraintExamples
createtableABC.TABLEX(COL1char(8)notnullprimarykey,COL2char(8)notnull,COL3char(8)notnull)
createtableABC.TABLEY(COL1char(8)notnull,COL2char(8)notnull,COL3char(8)notnull,primarykey(COL2,COL3))
33 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
GeneratedEnforcingIndex
§ Enforcesuniqueandprimarykeyconstraints
§ CreatedbyCREATETABLEandALTERTABLE– Suppressescreationofdefaultindex– Usesdefaultvaluesforindexattributes– CannotbealteredtobeNOTUNIQUE– CannotbedroppedwithDROPINDEXunlessreplacementdefined
§ GeneratedIndexnames– IDX###############– ###isa15digitnumberuniqueintheschema
34 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
ReplacingaGeneratedEnforcingIndex
§ UseCREATEUNIQUEINDEX
§ Columnsmustmatchenforcingindex
§ Inheritsenforcingindexattribute
§ Whenprimarykeyindexdropped– Areplacementinheritstheprimarykeyattribute
§ Generatedindexesdroppedautomatically
§ Non-generatedindexesmustbemanuallydropped
35 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
DefiningReferentialConstraints
§ Areferentialconstraintisspecifiedbycoding– REFERENCESclauseonacolumndefinition– FOREIGNKEYclauseinthecolumnlist
§ Aconstraintmaybenamed– CONSTRAINTname– Precedestheconstraintdefinition– Ifnotnamed,anameisgenerated
§ GEN###############
§ Morethanonereferentialconstraintmaybedefined
36 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
ReferentialConstraintsExample
createtableABC.TABLEX(COL1char(8),COL2char(8),foreignkey(COL1,COL2)referencesTABLEP,COL3char(8)notnull
constraintCON1referencesTABLEP(COL5))
37 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
DiscoveringConstraints
§ java.sql.DatabaseMetaData interfacemethods– getIndexInfo– getPrimaryKeys– getExportedKeys– getImportedKeys– getCrossReference
§ ODBCAPIfunctions– SQLStatistics– SQLPrimaryKeys– SQLForeignKeys
38 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
StandardSQLDDLSQLDDLenhancementsenableCAIDMStosupportdatabasedefinitionsprovidedbypopulartoolsandframeworks
CAIDMS19.0CAIDMS19.0enablesJavaandWindowsdeveloperstouseindustrystandardtechnologytocreate,access,andmaintainCAIDMSdatabases
SQLVirtualKeysSQLVirtualForeignKeysenabledeveloperstousestandardSQLtoaccessandupdatenetworkdatabases
SummaryAFewWordstoReview
39 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
RecommendedSessionsSESSION# TITLE DATE/TIME
MFX100S StrategyandVisionforCAIDMS 11/16/2016at12:45pm
MFX101S LegacyisnotaDirtyWord 11/16/2016at1:45pm
MFX102S CAIDMS19.0WebServicesforModernization 11/16/2016at3:00pm
MFX103S CAIDMS19.0SQLEnhancementsforModernization 11/16/2016at3:30pm
MFX104S JavaAccesstoCA-IDMSDataatBT(BritishTelecom) 11/16/2016at4:45pm
MFX105SImplementationandUseofGenericVTAMResourceswithParallelSYSPLEXFeatures(CA andCAXIA)
11/17/2016at12:45pm
MFX106S CAIDMSBufferTuning 11/17/2016at1:45pm
MFX107S M3AServicesMonitor,Measure,ManageandAlert 11/17/2016at3:00pm
MFX108S BirdsofaFeather/StumptheTechie! 11/17/2016at3:45pm
40 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
MustSeeDemos
DemoNameProductXTheater#location
DemoNameServicesYTheater#location
DemoNameSolutionYTheater#location
DemoNameProductXTheater#location
41 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
Questions?
42 ©2016CA.ALLRIGHTSRESERVED.@CAWORLD#CAWORLD
Stayconnectedatcommunities.ca.com
Thankyou.
@CAWORLD#CAWORLD ©2016CA.AllRIGHTSRESERVED.43 @CAWORLD#CAWORLD
MainframeandWorkloadAutomation
FormoreinformationonMainframeandWorkloadAutomation,pleasevisit:http://cainc.to/9GQ2JI