Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binder control card lookup capability #501

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build-conf/Cobol.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions languages/Cobol.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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){
Expand Down
9 changes: 9 additions & 0 deletions samples/MortgageApplication/application-conf/Cobol.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALIAS APSCMOR2
44 changes: 44 additions & 0 deletions utilities/BuildUtilities.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down