diff --git a/build-conf/Cobol.properties b/build-conf/Cobol.properties index 1920e9ed..9801cc2a 100644 --- a/build-conf/Cobol.properties +++ b/build-conf/Cobol.properties @@ -23,6 +23,10 @@ cobol_objPDS=${hlq}.OBJ cobol_dbrmPDS=${hlq}.DBRM cobol_BMS_PDS=${team}.BMS.COPY +# +# (Optional) Library to upload binder control cards +cobol_bndPDS=${hlq}.BND + # # COBOL load data sets cobol_loadPDS=${hlq}.LOAD diff --git a/languages/Cobol.groovy b/languages/Cobol.groovy index 345b1526..9674d659 100644 --- a/languages/Cobol.groovy +++ b/languages/Cobol.groovy @@ -20,7 +20,7 @@ println("** Building ${argMap.buildList.size()} ${argMap.buildList.size() == 1 ? buildUtils.assertBuildProperties(props.cobol_requiredBuildProperties) // create language datasets -def langQualifier = "cobol" +@Field def langQualifier = "cobol" buildUtils.createLanguageDatasets(langQualifier) // sort the build list based on build file rank if provided @@ -295,6 +295,7 @@ def createLinkEditCommand(String buildFile, LogicalFile logicalFile, String memb String linker = props.getFileProperty('cobol_linkEditor', buildFile) String linkEditStream = props.getFileProperty('cobol_linkEditStream', buildFile) String linkDebugExit = props.getFileProperty('cobol_linkDebugExit', buildFile) + String binderControlCardLookup = props.getFileProperty('cobol_binderControlCardLookup', buildFile) // obtain githash for buildfile String cobol_storeSSI = props.getFileProperty('cobol_storeSSI', buildFile) @@ -348,7 +349,16 @@ def createLinkEditCommand(String buildFile, LogicalFile logicalFile, String memb // add SYSLIN along the reference to SYSIN if configured through sysin_linkEditInstream linkedit.dd(new DDStatement().name("SYSLIN").dsn("${props.cobol_objPDS}($member)").options('shr')) if (sysin_linkEditInstream) linkedit.dd(new DDStatement().ddref("SYSIN")) - + + if (binderControlCardLookup && binderControlCardLookup.toBoolean()) { + // lookup binder control member and upload it + binderControlLibrary = buildUtils.lookupBinderControlCard(langQualifier, buildFile) + if (binderControlLibrary != null) { + if (props.verbose) println "*** Appending binder control card ${binderControlLibrary}(${member})" + linkedit.dd(new DDStatement().dsn("${binderControlLibrary}(${member})").options('shr')) + } + } + // add DD statements to the linkedit command String deployType = buildUtils.getDeployType("cobol", buildFile, logicalFile) if(isZUnitTestCase){ diff --git a/samples/MortgageApplication/application-conf/Cobol.properties b/samples/MortgageApplication/application-conf/Cobol.properties index 3af54ec9..261c5a83 100644 --- a/samples/MortgageApplication/application-conf/Cobol.properties +++ b/samples/MortgageApplication/application-conf/Cobol.properties @@ -57,6 +57,15 @@ cobol_linkDebugExit= # can be overridden by file properties cobol_linkEdit=true +# Flag indicating to lookup binder control cards for the linkage editor +# that are managed within the repository +# can be overridden by file properties +# default: false +cobol_binderControlCardLookup=true + +# Relative lookup path in the application repository to locate binder control files +cobol_binderControlCardLookupPath=${application}/binderControlCards/@{member}.bnd + # # store abbrev git hash in ssi field # available for buildTypes impactBuild, mergeBuild and fullBuild diff --git a/samples/MortgageApplication/binderControlCards/epscmort.bnd b/samples/MortgageApplication/binderControlCards/epscmort.bnd new file mode 100644 index 00000000..0798fdf7 --- /dev/null +++ b/samples/MortgageApplication/binderControlCards/epscmort.bnd @@ -0,0 +1 @@ + ALIAS APSCMOR2 diff --git a/utilities/BuildUtilities.groovy b/utilities/BuildUtilities.groovy index f78d3003..1a8081e9 100644 --- a/utilities/BuildUtilities.groovy +++ b/utilities/BuildUtilities.groovy @@ -634,6 +634,50 @@ def getDeployType(String langQualifier, String buildFile, LogicalFile logicalFil return deployType } +/* + * Lookup binder control card members + * if found it will upload binder control card to target libary + */ + +def lookupBinderControlCard(String langQualifier, String buildFile) { + + retval = null + + binderControlCardPath = props.getFileProperty("${langQualifier}_binderControlCardLookupPath", buildFile) + + // Locate binder control card + if (binderControlCardPath) { + fileName = buildFile.substring(buildFile.lastIndexOf("/") + 1, buildFile.lastIndexOf('.')) + def binderControlCard = binderControlCardPath.replace("\\n","\n").replace('@{member}', fileName) + + File binderControlCardFile = new File(getAbsolutePath(binderControlCard)) + if (binderControlCardFile.exists()) { + + binderControlCardLibrary = props."${langQualifier}_bndPDS" + libraryOptions = props."${langQualifier}_srcOptions" + if (binderControlCardLibrary && libraryOptions) { + // create library + createDatasets(binderControlCardLibrary.split(","), libraryOptions) + + // upload binder control card + String member = CopyToPDS.createMemberName(buildFile) + new CopyToPDS().file(binderControlCardFile).dataset(binderControlCardLibrary).member(member).execute() + retval = binderControlCardLibrary + } else { + if (props.verbose) println "***! Binder control card library name ($binderControlCardLibrary) or library options ($libraryOptions) not specified." + } + + } else { + if (props.verbose) println "*** No binder control card ($binderControlCardFile) found for build file $buildFile." + } + + } else { + // No Binder Control Card path specified + } + + return retval +} + /* * Creates a Generic PropertyRecord with the provided db2 information in bind.properties */