Execute
Defining an 'execute' job module in your grace.yml to run programs or batch jobs on z/OS.
The execute job module is used to run a pre-compiled and linked executable program (load module) or a batch job on z/OS. This is typically the final step in a compile-link-execute sequence or a standalone step to run existing batch applications.
Grace uses settings from the global config.defaults.linker for STEPLIB context if it's generating JCL, although execute jobs don't directly use linker-specific overrides. The primary program execution context is defined by the program field and the datasets.loadlib.
While execute jobs use common job fields and z/OS specific fields, the following are particularly relevant for type: execute.
type
- Value:
execute(Required) - Description: Identifies this job as a program execution task. Grace will use its internal
ZosExecuteHandlerto manage its execution.
program
- Type:
String - Required: Yes
- Description: Specifies the name of the executable program (load module) to run.
- This name must adhere to PDS member naming conventions.
- Grace's default JCL template for
executejobs will look for this program in theSTEPLIB, which by default points to thedatasets.loadlibdefined globally or via a job-level override. - This value is also available as
{{ .ProgramName }}in JCL templates for thePGM=parameter of theEXECstatement.
jcl (Optional)
- Type:
String - Description: Specifies the source of the JCL for this execute job.
- Omitted: Grace uses its internal default
execute.jcl.tmpltemplate. file://path/to/your_exec.jcl[.tmpl]: Uses your local JCL file (static or templated).zos://MY.PDS.JCL(RUNJCL): 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 (Optional)
- Description: While the
overridesblock exists, thecompilerandlinkersub-sections within it are not directly used by theexecutejob handler itself when it generates JCL using its default template (as it's not compiling or linking). However, if you provide a custom JCL template (jcl: file://) that happens to use variables like{{ .CompilerPgm }}for some reason, these can be resolved from defaults or overrides.
Generally,
overridesare not a primary concern fortype: executejobs.
inputs
- Description: Defines the data inputs required by the program being executed. These typically map to DD statements in the JCL.
- Common
name(DDName) values:SYSIN: Often used for runtime parameters, control cards, or inline data- Application-specific DDNames (e.g.
CUSTMAST,TRANFILE,PARMLIB)
- Path sources can be varied:
src://for local files uploaded by Gracezos-temp://for intermediate datasets from prior Grace jobszos://for preexisting mainframe datasets
See Virtual Paths & Job I/O for details on
pathprefixes and defining input paramenters likedisp.
outputs
- Description: Defines the datasets that the executed program will create or write to. These map to output DD statements in the JCL.
- Common
name(DDName) values:SYSOUT,SYSPRINT: For standard job output listings or application reports.- Application-specific DDNames (e.g.
NEWMAST,ERRFILE,SUMMRPT).
- Output paths can be:
zos-temp://for Grace-managed temporary datasetszos://for persistent datasetsfile://if the workflow involves downloading the output later via a subsequentshelljob.
See Virtual Paths & Job I/O for details on
pathprefixes and defining output paramenters likedisp,space,dcb, andkeep.
JCL generation context
When Grace generates JCL for an execute job (either using its internal template or a user-provided jcl: file:// template), the following specific data is made available, in addition to common job data and resolved I/O:
{{ .ProgramName }}: The name of the program to be executed (fromjob.program){{ .LoadLib }}: The DSN of the load library whereProgramNameis expected to reside (fromdatasets.loadlibor a job-level override). This is typically used for theSTEPLIB DDin the JCL.
Refer to the JCL Templating Guide for a full list of variables available in JCL templates.
Behavior notes
- Program location: The program specified in
job.programmust exist in theSTEPLIBconcatenation (typically thedatasets.loadlibor system libraries likeLINKLST/LPA). If Grace generates the JCL, it will include aSTEPLIB DDpointing to the resolved load library. If you provide custom JCL, you are responsible for ensuring the correctSTEPLIBis defined. - Dependencies:
executejobs often depend onlinkeditjobs that create the program to be run, or other jobs that prepare input data. Ensure you include necessary dependencies in this job'sdepends_onfield. - Return codes: The success or failure of an
executejob is determined by the return code of the executed program.CC 0000is typically success. Grace monitors these return codes.
The execute job module is fundamental for running your compiled applications and existing batch processes as part of a Grace-managed workflow.