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
ZosExecuteHandler
to 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
execute
jobs will look for this program in theSTEPLIB
, which by default points to thedatasets.loadlib
defined globally or via a job-level override. - This value is also available as
{{ .ProgramName }}
in JCL templates for thePGM=
parameter of theEXEC
statement.
jcl
(Optional)
- Type:
String
- Description: Specifies the source of the JCL for this execute job.
- Omitted: Grace uses its internal default
execute.jcl.tmpl
template. 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
overrides
block exists, thecompiler
andlinker
sub-sections within it are not directly used by theexecute
job 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,
overrides
are not a primary concern fortype: execute
jobs.
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
path
prefixes 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 subsequentshell
job.
See Virtual Paths & Job I/O for details on
path
prefixes 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 whereProgramName
is expected to reside (fromdatasets.loadlib
or a job-level override). This is typically used for theSTEPLIB DD
in 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.program
must exist in theSTEPLIB
concatenation (typically thedatasets.loadlib
or system libraries likeLINKLST
/LPA
). If Grace generates the JCL, it will include aSTEPLIB DD
pointing to the resolved load library. If you provide custom JCL, you are responsible for ensuring the correctSTEPLIB
is defined. - Dependencies:
execute
jobs often depend onlinkedit
jobs that create the program to be run, or other jobs that prepare input data. Ensure you include necessary dependencies in this job'sdepends_on
field. - Return codes: The success or failure of an
execute
job is determined by the return code of the executed program.CC 0000
is 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.