Linkedit
Defining a 'linkedit' job module in your grace.yml to create executable load modules on z/OS.
The linkedit
job module is used to invoke the linkage editor on z/OS. Its primary purpose is to process object decks (typically from a compile
step) and other inputs (like control statements or other object modules/load modules) to produce an executable load module in a specified load library.
Grace uses settings from the global config.defaults.linker
block, which can be optionally overridden at the job level using the overrides.linker
block within this job definition.
While linkedit
jobs use common job fields and z/OS specific fields, the following are particularly relevant for type: linkedit
.
type
- Value:
linkedit
(Required) - Description: Identifies this job as a linkage-editing task. Grace will use its internal
ZosLinkeditHandler
to manage its execution.
program
- Type:
String
- Description: This is a crucial field for
linkedit
jobs. It specifies the name of the output load module that will be created in the target load library.- This name must adhere to PDS member naming conventions.
- The target load library is detemined by
datasets.loadlib
(globally or job-level override). - This value is also available as
{{ .ProgramName }}
in JCL templates- e.g. for
NAME {{ .ProgramName }}(R)
control statements or the
SYSLMOD DD DSN={{ .LoadLib }}({{ .ProgramName }})
.
- e.g. for
jcl
(Optional)
- Type:
String
- Description: Specifies the source of the JCL for this link-edit job.
- Omitted: Grace uses its internal default
linkedit.jcl.tmpl
template. file://path/to/your_link.jcl[.tmpl]
: Uses your local JCL file (static or templated).zos://MY.PDS.JCL(LINKJCL)
: 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.linker
(Optional)
- Type:
Object
- Description: Allows you to specify linkage editor
pgm
,parms
, orsteplib
settings that override the globalconfig.defaults.linker
for this job.
See z/OS Job Specifics for more details.
inputs
- Description: Defines the inputs to the linkage editor.
- Common
name
(DDName) values for link-edit:SYSLIN
(Standard) : The primary input containing object code (from a compiler) and/or linkage editor control statements.- e.g.
path: zos-temp://myprog.obj
(output from acompile
job)
- e.g.
SYSIN
(Standard, but often embedded inSYSLIN or JCL
) : Used for additional linkage editor control statements if not provided viaSYSLIN
.- e.g.
path: src://linkedit.control.txt
- e.g.
- Custom DDNames (e.g.
OBJLIB
,MODLIB
): To include other object modules or load modules from existing libraries as part of the link-edit process. These would typically be referenced byINCLUDE
statements within yourSYSLIN
orSYSIN
control cards.- e.g.
path: zos://COMMON.OBJLIB.PDS
- e.g.
path: zos://PROD.LOADLIB(COMMONRTN)
- e.g.
See Virtual Paths & Job I/O for details on
path
prefixes.
outputs
- Description: Defines the outputs produced by the linkage editor.
- Implicit output
SYSLMOD
:- The primary output of a
linkedit
job is the load module. Grace implicitly handles theSYSLMOD DD
statement in its defaultlinkedit.jcl.tmpl
template. - The DSN for
SYSLMOD
is constructed as{{ .LoadLib }}({{ .ProgramName }})
, where{{ .LoadLib }}
is the resolved load library (fromdatasets.loadlib
) and{{ .ProgramName }}
is fromjob.program
. - You typically do not need to explicitly define an output with
name: SYSLMOD
unless you want to direct it to a non-standard location or manage it as azos-temp://
path (which is unusual for the final load module).
- The primary output of a
- Common explicit
name
(DDName) values:SYSPRINT
(Standard) : For the linkage editor listing, map, and diagnostic messages.- e.g.
path: zos-temp://linkedit.map.txt
- e.g.
- Other DDs for side-files if your linkage editor process creates them.
In essence, the
outputs
section of alinkedit
job is not necessary unless you wish to direct it to a non-standard location outside your load library.
See Virtual Paths & Job I/O for details on
path
prefixes.
JCL generation context
When Grace generates JCL for a linkedit job (either using its internal template or a user-provided jcl: file://
template), the following specific data related to linker settings is made available to the template, in addition to common job data:
{{ .LinkerPgm }}
: The resolved linkage editor program name.{{ .LinkerParms }}
: The resolved linkage editor parameters.{{ .LinkerSteplib }}
: The resolved linkage editorSTEPLIB
DSN (empty string if none).{{ .ProgramName }}
: The name of the output load module (fromjob.program
).{{ .LoadLib }}
: The DSN of the target load library.
These are derived from job.overrides.linker, config.defaults.linker, job.program, and datasets.loadlib
.
Refer to the JCL Templating Guide for a full list of variables available in JCL templates.
Behavior notes
- Dependencies:
linkedit
jobs typically depend on one or morecompile
jobs that produce the necessary object modules (SYSLIN
input). Ensure you include necessary dependencies in this job'sdepends_on
field. - Load module creation: The successful completion of a
linkedit
job results in a new or updated load module in the specified load library. - Return codes: A successful link-edit usually results in a return code of
0000
. Warnings (e.g. unresolved weak externals) might produce0004
. Higher codes indicate errors.
The linkedit
job module is essential for creating executable programs on z/OS within your Grace automated workflows.