From 8ef71ee255847414c19f2c62ad20e5da3284ba04 Mon Sep 17 00:00:00 2001 From: Dennis Behm Date: Tue, 2 Apr 2024 18:25:28 +0200 Subject: [PATCH 1/8] prototype binder control card processing Signed-off-by: Dennis Behm --- languages/Cobol.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/languages/Cobol.groovy b/languages/Cobol.groovy index 345b1526..ffe751ab 100644 --- a/languages/Cobol.groovy +++ b/languages/Cobol.groovy @@ -348,7 +348,8 @@ 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")) - + linkedit.dd(new DDStatement().dsn("DBEHM.DBB.UB.LINK(LNKOPT)").options('shr')) + // add DD statements to the linkedit command String deployType = buildUtils.getDeployType("cobol", buildFile, logicalFile) if(isZUnitTestCase){ From 8263329f8a0c8eb472f7eddbe5b1d80d8b78006a Mon Sep 17 00:00:00 2001 From: Dennis Behm Date: Wed, 3 Apr 2024 11:16:23 +0200 Subject: [PATCH 2/8] Implement bindCard lookup function Signed-off-by: Dennis Behm --- build-conf/Cobol.properties | 4 ++ languages/Cobol.groovy | 8 +++- .../application-conf/Cobol.properties | 9 ++++ .../binderControlCards/epscmort.bnd | 1 + utilities/BuildUtilities.groovy | 44 +++++++++++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 samples/MortgageApplication/binderControlCards/epscmort.bnd 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 ffe751ab..ba0deaff 100644 --- a/languages/Cobol.groovy +++ b/languages/Cobol.groovy @@ -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,12 @@ 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")) - linkedit.dd(new DDStatement().dsn("DBEHM.DBB.UB.LINK(LNKOPT)").options('shr')) + + if (binderControlCardLookup && binderControlCardLookup.toBoolean()) { + + binderControlLibrary = buildUtils.lookupBinderControlCard(langQualifier, buildFile) + if (binderControlLibrary != null) linkedit.dd(new DDStatement().dsn("${binderControlLibrary}(${member})").options('shr')) + } // add DD statements to the linkedit command String deployType = buildUtils.getDeployType("cobol", buildFile, logicalFile) 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..0fb70d3b 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).substring(buildFile.lastIndexOf('.')) + def binderControlCard = replace("\\n","\n").replace('@{member}', fileName) + + File binderControlCardFile = new File(getAbsolutePath(binderControlCard)) + if (binderControlCardFile.exists()) { + + binderControlCardLibrary = props."${lang}_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 "***! Binder Control Card ($binderControlCardFile) for build file $buildFile not found." + } + + } else { + // No Binder Control Card path specified + } + + return retval +} + /* * Creates a Generic PropertyRecord with the provided db2 information in bind.properties */ From caca1e3568d64b226dc4ea581d6707d965d68d76 Mon Sep 17 00:00:00 2001 From: Dennis Behm Date: Wed, 3 Apr 2024 11:23:37 +0200 Subject: [PATCH 3/8] make langQualier globally accessible by the script Signed-off-by: Dennis Behm --- languages/Cobol.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/Cobol.groovy b/languages/Cobol.groovy index ba0deaff..aad03b52 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 @@ -351,7 +351,7 @@ def createLinkEditCommand(String buildFile, LogicalFile logicalFile, String memb 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) linkedit.dd(new DDStatement().dsn("${binderControlLibrary}(${member})").options('shr')) } From 4925ac2a2e9c18bae2cc2783843ea77470314c3a Mon Sep 17 00:00:00 2001 From: Dennis Behm Date: Wed, 3 Apr 2024 11:32:05 +0200 Subject: [PATCH 4/8] correctly substring the member Signed-off-by: Dennis Behm --- utilities/BuildUtilities.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/BuildUtilities.groovy b/utilities/BuildUtilities.groovy index 0fb70d3b..f8c9ff0f 100644 --- a/utilities/BuildUtilities.groovy +++ b/utilities/BuildUtilities.groovy @@ -647,7 +647,7 @@ def lookupBinderControlCard(String langQualifier, String buildFile) { // Locate binder control card if (binderControlCardPath) { - fileName = buildFile.substring(buildFile.lastIndexOf("/") + 1).substring(buildFile.lastIndexOf('.')) + fileName = buildFile.substring(buildFile.lastIndexOf("/") + 1, buildFile.lastIndexOf('.')) def binderControlCard = replace("\\n","\n").replace('@{member}', fileName) File binderControlCardFile = new File(getAbsolutePath(binderControlCard)) From 81c8936c20cc412a942870f9830a858b97734f22 Mon Sep 17 00:00:00 2001 From: Dennis Behm Date: Wed, 3 Apr 2024 11:32:21 +0200 Subject: [PATCH 5/8] write message in verbose logging Signed-off-by: Dennis Behm --- languages/Cobol.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/languages/Cobol.groovy b/languages/Cobol.groovy index aad03b52..9674d659 100644 --- a/languages/Cobol.groovy +++ b/languages/Cobol.groovy @@ -353,7 +353,10 @@ def createLinkEditCommand(String buildFile, LogicalFile logicalFile, String memb if (binderControlCardLookup && binderControlCardLookup.toBoolean()) { // lookup binder control member and upload it binderControlLibrary = buildUtils.lookupBinderControlCard(langQualifier, buildFile) - if (binderControlLibrary != null) linkedit.dd(new DDStatement().dsn("${binderControlLibrary}(${member})").options('shr')) + 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 From 76f56298f67333809c8efb7637d6de247275cec0 Mon Sep 17 00:00:00 2001 From: Dennis Behm Date: Wed, 3 Apr 2024 11:38:47 +0200 Subject: [PATCH 6/8] fix syntax error on replace Signed-off-by: Dennis Behm --- utilities/BuildUtilities.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/BuildUtilities.groovy b/utilities/BuildUtilities.groovy index f8c9ff0f..ca79ad03 100644 --- a/utilities/BuildUtilities.groovy +++ b/utilities/BuildUtilities.groovy @@ -648,7 +648,7 @@ def lookupBinderControlCard(String langQualifier, String buildFile) { // Locate binder control card if (binderControlCardPath) { fileName = buildFile.substring(buildFile.lastIndexOf("/") + 1, buildFile.lastIndexOf('.')) - def binderControlCard = replace("\\n","\n").replace('@{member}', fileName) + def binderControlCard = binderControlCardPath.replace("\\n","\n").replace('@{member}', fileName) File binderControlCardFile = new File(getAbsolutePath(binderControlCard)) if (binderControlCardFile.exists()) { From aaa8db451360003d09196c439b79d3898072e2c8 Mon Sep 17 00:00:00 2001 From: Dennis Behm Date: Wed, 3 Apr 2024 11:44:16 +0200 Subject: [PATCH 7/8] fix syntax error on replace Signed-off-by: Dennis Behm --- utilities/BuildUtilities.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/BuildUtilities.groovy b/utilities/BuildUtilities.groovy index ca79ad03..21c4257f 100644 --- a/utilities/BuildUtilities.groovy +++ b/utilities/BuildUtilities.groovy @@ -653,7 +653,7 @@ def lookupBinderControlCard(String langQualifier, String buildFile) { File binderControlCardFile = new File(getAbsolutePath(binderControlCard)) if (binderControlCardFile.exists()) { - binderControlCardLibrary = props."${lang}_bndPDS" + binderControlCardLibrary = props."${langQualifier}_bndPDS" libraryOptions = props."${langQualifier}_srcOptions" if (binderControlCardLibrary && libraryOptions) { // create library From 12d4545213fe0349c5ae02044ff6894ec06ded82 Mon Sep 17 00:00:00 2001 From: Dennis Behm Date: Wed, 3 Apr 2024 11:52:33 +0200 Subject: [PATCH 8/8] update output messages Signed-off-by: Dennis Behm --- utilities/BuildUtilities.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/BuildUtilities.groovy b/utilities/BuildUtilities.groovy index 21c4257f..1a8081e9 100644 --- a/utilities/BuildUtilities.groovy +++ b/utilities/BuildUtilities.groovy @@ -664,11 +664,11 @@ def lookupBinderControlCard(String langQualifier, String 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." + if (props.verbose) println "***! Binder control card library name ($binderControlCardLibrary) or library options ($libraryOptions) not specified." } } else { - if (props.verbose) println "***! Binder Control Card ($binderControlCardFile) for build file $buildFile not found." + if (props.verbose) println "*** No binder control card ($binderControlCardFile) found for build file $buildFile." } } else {