Skip to content

Commit

Permalink
Enable Db2 bind package and plan for Assembler and PLI (#583)
Browse files Browse the repository at this point in the history
* Db2 bind package and plan for Assembler and PLI
* Refactor Db2 binds on user builds

Signed-off-by: Dennis Behm <[email protected]>
  • Loading branch information
dennis-behm authored Dec 10, 2024
1 parent aaefc70 commit 0b682ae
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 26 deletions.
30 changes: 30 additions & 0 deletions languages/Assembler.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.ibm.dbb.build.report.records.*
@Field BuildProperties props = BuildProperties.getInstance()
@Field def buildUtils= loadScript(new File("${props.zAppBuildDir}/utilities/BuildUtilities.groovy"))
@Field def impactUtils= loadScript(new File("${props.zAppBuildDir}/utilities/ImpactUtilities.groovy"))
@Field def bindUtils= loadScript(new File("${props.zAppBuildDir}/utilities/BindUtilities.groovy"))

println("** Building ${argMap.buildList.size()} ${argMap.buildList.size() == 1 ? 'file' : 'files'} mapped to ${this.class.getName()}.groovy script")

Expand Down Expand Up @@ -157,6 +158,35 @@ sortedList.each { buildFile ->
}
}
}

//perform Db2 binds on userbuild
if (rc <= maxRC && buildUtils.isSQL(logicalFile) && props.userBuild) {
//perform Db2 Bind Pkg
bind_performBindPackage = props.getFileProperty('bind_performBindPackage', buildFile)
if (bind_performBindPackage && bind_performBindPackage.toBoolean()) {
int bindMaxRC = props.getFileProperty('bind_maxRC', buildFile).toInteger()
def (bindRc, bindLogFile) = bindUtils.bindPackage(buildFile, props.assembler_dbrmPDS);
if ( bindRc > bindMaxRC) {
String errorMsg = "*! The bind package return code ($bindRc) for $buildFile exceeded the maximum return code allowed ($props.bind_maxRC)"
println(errorMsg)
props.error = "true"
buildUtils.updateBuildResult(errorMsg:errorMsg,logs:["${member}_bind_pkg.log":bindLogFile])
}
}

//perform Db2 Bind Plan
bind_performBindPlan = props.getFileProperty('bind_performBindPlan', buildFile)
if (bind_performBindPlan && bind_performBindPlan.toBoolean()) {
int bindMaxRC = props.getFileProperty('bind_maxRC', buildFile).toInteger()
def (bindRc, bindLogFile) = bindUtils.bindPlan(buildFile);
if ( bindRc > bindMaxRC) {
String errorMsg = "*! The bind plan return code ($bindRc) for $buildFile exceeded the maximum return code allowed ($props.bind_maxRC)"
println(errorMsg)
props.error = "true"
buildUtils.updateBuildResult(errorMsg:errorMsg,logs:["${member}_bind_plan.log":bindLogFile])
}
}
}

// clean up passed DD statements
job.stop()
Expand Down
51 changes: 26 additions & 25 deletions languages/Cobol.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ sortedList.each { buildFile ->
int rc = compile.execute()
int maxRC = props.getFileProperty('cobol_compileMaxRC', buildFile).toInteger()

boolean bindFlag = true

if (rc > maxRC) {
bindFlag = false
String errorMsg = "*! The compile return code ($rc) for $buildFile exceeded the maximum return code allowed ($maxRC)"
Expand All @@ -99,7 +97,6 @@ sortedList.each { buildFile ->
maxRC = props.getFileProperty('cobol_linkEditMaxRC', buildFile).toInteger()

if (rc > maxRC) {
bindFlag = false
String errorMsg = "*! The link edit return code ($rc) for $buildFile exceeded the maximum return code allowed ($maxRC)"
println(errorMsg)
props.error = "true"
Expand All @@ -116,29 +113,33 @@ sortedList.each { buildFile ->
}
}

//perform Db2 Bind Pkg only on User Build and perfromBindPackage property
bind_performBindPackage = props.getFileProperty('bind_performBindPackage', buildFile)
if (props.userBuild && bindFlag && logicalFile.isSQL() && bind_performBindPackage && bind_performBindPackage.toBoolean()) {
int bindMaxRC = props.getFileProperty('bind_maxRC', buildFile).toInteger()
def (bindRc, bindLogFile) = bindUtils.bindPackage(buildFile, props.cobol_dbrmPDS);
if ( bindRc > bindMaxRC) {
String errorMsg = "*! The bind package return code ($bindRc) for $buildFile exceeded the maximum return code allowed ($props.bind_maxRC)"
println(errorMsg)
props.error = "true"
buildUtils.updateBuildResult(errorMsg:errorMsg,logs:["${member}_bind_pkg.log":bindLogFile])
//perform Db2 binds on userbuild
if (rc <= maxRC && buildUtils.isSQL(logicalFile) && props.userBuild) {

//perform Db2 Bind Pkg
bind_performBindPackage = props.getFileProperty('bind_performBindPackage', buildFile)
if ( bind_performBindPackage && bind_performBindPackage.toBoolean()) {
int bindMaxRC = props.getFileProperty('bind_maxRC', buildFile).toInteger()
def (bindRc, bindLogFile) = bindUtils.bindPackage(buildFile, props.cobol_dbrmPDS);
if ( bindRc > bindMaxRC) {
String errorMsg = "*! The bind package return code ($bindRc) for $buildFile exceeded the maximum return code allowed ($props.bind_maxRC)"
println(errorMsg)
props.error = "true"
buildUtils.updateBuildResult(errorMsg:errorMsg,logs:["${member}_bind_pkg.log":bindLogFile])
}
}
}

//perform Db2 Bind Pkg only on User Build and perfromBindPackage property
bind_performBindPlan = props.getFileProperty('bind_performBindPlan', buildFile)
if (props.userBuild && bindFlag && logicalFile.isSQL() && bind_performBindPlan && bind_performBindPlan.toBoolean()) {
int bindMaxRC = props.getFileProperty('bind_maxRC', buildFile).toInteger()
def (bindRc, bindLogFile) = bindUtils.bindPlan(buildFile);
if ( bindRc > bindMaxRC) {
String errorMsg = "*! The bind plan return code ($bindRc) for $buildFile exceeded the maximum return code allowed ($props.bind_maxRC)"
println(errorMsg)
props.error = "true"
buildUtils.updateBuildResult(errorMsg:errorMsg,logs:["${member}_bind_plan.log":bindLogFile])

//perform Db2 Bind Plan
bind_performBindPlan = props.getFileProperty('bind_performBindPlan', buildFile)
if (bind_performBindPlan && bind_performBindPlan.toBoolean()) {
int bindMaxRC = props.getFileProperty('bind_maxRC', buildFile).toInteger()
def (bindRc, bindLogFile) = bindUtils.bindPlan(buildFile);
if ( bindRc > bindMaxRC) {
String errorMsg = "*! The bind plan return code ($bindRc) for $buildFile exceeded the maximum return code allowed ($props.bind_maxRC)"
println(errorMsg)
props.error = "true"
buildUtils.updateBuildResult(errorMsg:errorMsg,logs:["${member}_bind_plan.log":bindLogFile])
}
}
}

Expand Down
33 changes: 32 additions & 1 deletion languages/PLI.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.ibm.dbb.build.report.records.*
@Field BuildProperties props = BuildProperties.getInstance()
@Field def buildUtils= loadScript(new File("${props.zAppBuildDir}/utilities/BuildUtilities.groovy"))
@Field def impactUtils= loadScript(new File("${props.zAppBuildDir}/utilities/ImpactUtilities.groovy"))
@Field def bindUtils= loadScript(new File("${props.zAppBuildDir}/utilities/BindUtilities.groovy"))

println("** Building ${argMap.buildList.size()} ${argMap.buildList.size() == 1 ? 'file' : 'files'} mapped to ${this.class.getName()}.groovy script")

Expand Down Expand Up @@ -74,7 +75,7 @@ sortedList.each { buildFile ->
// compile the program
int rc = compile.execute()
int maxRC = props.getFileProperty('pli_compileMaxRC', buildFile).toInteger()

if (rc > maxRC) {
String errorMsg = "*! The compile return code ($rc) for $buildFile exceeded the maximum return code allowed ($maxRC)"
println(errorMsg)
Expand Down Expand Up @@ -110,6 +111,36 @@ sortedList.each { buildFile ->
}
}
}

//perform Db2 binds on userbuild
if (rc <= maxRC && buildUtils.isSQL(logicalFile) && props.userBuild) {

//perform Db2 Bind Pkg
bind_performBindPackage = props.getFileProperty('bind_performBindPackage', buildFile)
if (bind_performBindPackage && bind_performBindPackage.toBoolean()) {
int bindMaxRC = props.getFileProperty('bind_maxRC', buildFile).toInteger()
def (bindRc, bindLogFile) = bindUtils.bindPackage(buildFile, props.pli_dbrmPDS);
if ( bindRc > bindMaxRC) {
String errorMsg = "*! The bind package return code ($bindRc) for $buildFile exceeded the maximum return code allowed ($props.bind_maxRC)"
println(errorMsg)
props.error = "true"
buildUtils.updateBuildResult(errorMsg:errorMsg,logs:["${member}_bind_pkg.log":bindLogFile])
}
}

//perform Db2 Bind plan
bind_performBindPlan = props.getFileProperty('bind_performBindPlan', buildFile)
if (bind_performBindPlan && bind_performBindPlan.toBoolean()) {
int bindMaxRC = props.getFileProperty('bind_maxRC', buildFile).toInteger()
def (bindRc, bindLogFile) = bindUtils.bindPlan(buildFile);
if ( bindRc > bindMaxRC) {
String errorMsg = "*! The bind plan return code ($bindRc) for $buildFile exceeded the maximum return code allowed ($props.bind_maxRC)"
println(errorMsg)
props.error = "true"
buildUtils.updateBuildResult(errorMsg:errorMsg,logs:["${member}_bind_plan.log":bindLogFile])
}
}
}
}
// clean up passed DD statements
job.stop()
Expand Down

0 comments on commit 0b682ae

Please sign in to comment.