-
Notifications
You must be signed in to change notification settings - Fork 144
Code Expansion Utility
Some build processes require to expand copybooks before invoking the different steps like precompilers, compiler and link editor, due to how source code was originally designed and written.
For example, you can have EXEC CICS
or EXEC SQL
statements within an Assembler copybook. Because the Assembler compiler doesn’t have an integrated co-processor like the Cobol compiler, and because the precompilers for Db2 or CICS don't expand the code, some issues may be encountered when compiling the source code with zAppBuild. In that configuration, the included copybooks during the compilation step still contain subsystem-specific statements, which are not understood by the Assembler compiler.
To resolve this issue, the build process requires to expand the copybooks before invoking the precompiler steps.
ISPF provides an expansion utility, which can be integrated into a custom zAppBuild language script to expand the source.
The documentation including its options can be found at:
Please also be aware of existing Restrictions on member expansion and member parts lists
The below method allows you to invoke the copy expansion utility. It should be integrated into the language script after the uploading of files and dependencies to the build libraries, but before invoking the precompile steps. The other steps shouldn’t be modified, because the method below overwrites the input dataset for the precompile and compile steps, here "${props.assembler_srcPDS}($member)"
.
def expandSource(String buildFile, String member, File logFile) {
// Configuration per type could end up in a build-conf language specific build property
def expandSource = new MVSExec().pgm("ISRLEMX").parm("ASM,${member},B,N,E,20, ,00,ENU,4,7,1,/,SYSDA")
// Providing the library concatenation to find source and include files. Here a simple hard-coded approach.
// Might be provided via a argument of this method, if you need to reuse it across multiple language scripts
expandSource.dd(new DDStatement().name("ISRLCODE").dsn(props.assembler_srcPDS).options("shr"))
expandSource.dd(new DDStatement().dsn(props.assembler_macroPDS).options("shr"))
// Todo: Additional copy libraries, see implementation in the compile step.
//expandSource.dd(new DDStatement().dsn("PROD.ASMCOPY.SCOMN").options("shr"))
// Output stream
expandSource.dd(new DDStatement().name("ISRLEXPD").dsn("${props.assembler_srcPDS}($member)").options("shr"))
// Messages and XREF logs:
expandSource.dd(new DDStatement().name("ISRLMSG").options(props.assembler_tempOptionsTranslator))
expandSource.dd(new DDStatement().name("ISRLXREF").options(props.assembler_tempOptionsTranslator))
// append outputs to log file
expandSource.copy(new CopyToHFS().ddName("ISRLEXPD").file(logFile).hfsEncoding(props.logEncoding).append(true))
expandSource.copy(new CopyToHFS().ddName("ISRLMSG").file(logFile).hfsEncoding(props.logEncoding).append(true))
expandSource.copy(new CopyToHFS().ddName("ISRLXREF").file(logFile).hfsEncoding(props.logEncoding).append(true))
// returning object, execute in mainline section of the language script
return expandSource
}
Thanks to Keith T. Haynes and Preston A. Rominger for sharing the initial snippet.