Compile
Defining a 'compile' job module in your grace.yml to compile source code on z/OS.
The compile job module is used to invoke a compiler on z/OS to process source code (e.g., COBOL, PL/I, Assembler) and produce an object deck or other compiler outputs.
Grace uses the settings from the global config.defaults.compiler block, which can be optionally overridden at the job level using the overrides.compiler block within this job definition.
While compile jobs use common job fields like name, depends_on, etc. and z/OS specific fields like jcl, program, and overrides, the following are particularly relevant for type: compile.
type
- Value:
compile(Required) - Description: Identifies this job as a compilation task. Grace will use its internal
ZosCompileHandlerto manage its execution.
program (Optional metadata)
- Type:
String - Description: For a
compilejob, theprogramfield is primarily metadata. The actual compiler program (e.g.IGYCRCTL) is determined byconfig.defaults.compiler.pgmorjob.overrides.compiler.pgm.
If you follow a convention where a
compilejob forMYPROGis expected to produce an object deck that a subsequentlinkeditjob (also withprogram: MYPROG) will use - specifying it here can improve clarity. It's available as{{ .ProgramName }}in JCL templates.
jcl (Optional)
- Type:
String - Description: Specifies the source of the JCL for this compile job.
- Omitted: Grace uses its internal default
compile.jcl.tmpltemplate. file://path/to/your_compile.jcl[.tmpl]: Uses your local JCL file (static or templated).zos://MY.PDS.JCL(COMPILEJ): Uses an existing JCL member on the mainframe.
- Omitted: Grace uses its internal default
See z/OS Job Specifics and JCL Templates for more details.
overrides.compiler (Optional)
- Type:
Object - Description: Allows you to specify compiler
pgm,parms, orsteplibsettings that override the globalconfig.defaults.compilerfor this job.
See z/OS Job Specifics - Overrides for more details.
inputs
- Description: Defines the inputs to the compiler.
- Common
name(DDName) values for compilers:SYSIN(Standard) : The primary source code file to be compiled.- e.g.
path: src://myprog.cbl
- e.g.
COPYLIB/SYSLIB/ custom DDs for copybooks: To specify PDS(E) libraries containing copybooks or include members.- e.g.
path: zos://SHARED.COPYLIB.PDS - e.g.
path: src://copybook.cpy(if Grace should uploadsrc/projectcopy.cpytodatasets.src(PROJECTCOPY)which is then included in a concatenated DD likeSYSLIBin the JCL template)- Note: Your JCL template must be designed to handle such concatenated DDs if multiple
src://copybooks are uploaded to the samedatasets.src.
- Note: Your JCL template must be designed to handle such concatenated DDs if multiple
- e.g.
See Virtual Paths & Job I/O for details on
pathprefixes.
outputs
- Description: Defines the outputs produced by the compiler.
- Common
name(DDName) values for compilers:SYSLIN(Standard) : The object deck produced by the compiler.- e.g.
path: zos-temp://myprog.obj
- e.g.
SYSPRINT/SYSDEBUG/ etc.: For compiler listings, diagnostic messages, or other output files.- e.g.
path: zos-temp://compiler.listing.txt - e.g.
path: file://logs/compiler_output.txt
- e.g.
See Virtual Paths & Job I/O for details on
pathprefixes.
JCL generation context
When Grace generates JCL for a compile job (either using its internal template or a user-provided jcl: file:// template), the following specific data related to compiler settings is made available to the template, in addition to common job data:
{{ .CompilerPgm }}: The resolved compiler program name.{{ .CompilerParms }}: The resolved compiler parameters.{{ .CompilerSteplib }}: The resolved compilerSTEPLIBDSN (empty string if none).
These are derived from config.defaults.compiler or job.overrides.compiler.
Refer to the JCL Templating Guide for a full list of variables available in JCL templates.
Behavior notes
- Source upload: If
SYSINor other inputs usesrc://paths,grace deckwill upload these local files to the PDS defined indatasets.src(or its job-level override). The generated JCL will then point to these uploaded members. - Object deck handling: The
SYSLINouput, typically specified with azos-temp://path, is crucial as it's usually consumed by a subsequentlinkeditjob. Grace automatically manages the DSN and cleanup for this temporary dataset. - Return codes: Successful compilations usually result in a return code of
0000or0004(warnings). Higher return codes often indicate errors. Grace's executor logic uses these to determine jobs success or failure.
By configuring a compile job module, you can integrate source code compilation on z/OS seamlessly into your automated Grace workflows.