diff --git a/languages/Assembler.groovy b/languages/Assembler.groovy index ce63fdbf..a40bbab7 100644 --- a/languages/Assembler.groovy +++ b/languages/Assembler.groovy @@ -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") @@ -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() diff --git a/languages/Cobol.groovy b/languages/Cobol.groovy index 786553f1..82bae6b0 100644 --- a/languages/Cobol.groovy +++ b/languages/Cobol.groovy @@ -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)" @@ -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" @@ -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]) + } } } diff --git a/languages/PLI.groovy b/languages/PLI.groovy index e82a3849..d0cd7b9f 100644 --- a/languages/PLI.groovy +++ b/languages/PLI.groovy @@ -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") @@ -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) @@ -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()