Hi Dan,
The JSON that returns has quite a bit of information returned from `zos_job_submit`; in that JSON result there is a jobs property mapped to an array, once you access that array you can drill down to various values one of them being job_id. The jobs array currently will always be an array of size 1 (index [0]), this design was intentional for future capabilities to submit more than one job and thus not introducing breaking changes yrs down the line.
Ultimately what you are asking to do can be done with this snippet:
tasks:
- name: Convert a local JCL file to IBM-037 and submit the job
zos_job_submit:
src: "{{playbook_dir}}/files/HELLO.jcl"
location: LOCAL
wait: false
encoding:
from: ISO8859-1
to: IBM-037
register: job_sub_result
- name: Setting facts `sub_job_id` and `sub_job_name`
set_fact:
sub_job_id: "{{ job_sub_result.jobs[0].job_id }}"
sub_job_name: "{{ job_sub_result.jobs[0].job_name }}"
Attached is a sample that does a bit more than what you asked for, the comments in the playbook will walk you through the tasks.
When using the sample, please be sure to update the `hosts` according to your inventory and the `src` for the JCL provided to module `zos_job_submit`.
If you want to see an example of the module `zos_job_submit` module return values where `-job_id` is returned, you can follow this example in the docs.
------------------------------
DEMETRIOS DIMATOS
------------------------------