# Use zoau JSUB to submit jcl

**URL:** <https://forum.ansible.com/t/use-zoau-jsub-to-submit-jcl/6687>\
**Category:** Get Help\
**Created:** [June 20, 2024, 5:58pm UTC](https://forum.ansible.com/t/use-zoau-jsub-to-submit-jcl/6687 "2024-06-20T17:58:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![U6crgb0](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@U6crgb0](https://forum.ansible.com/u/U6crgb0)\
**Post date:** [June 20, 2024, 5:58pm UTC](https://forum.ansible.com/t/use-zoau-jsub-to-submit-jcl/6687/1 "2024-06-20T17:58:27Z")

</div>

this code is from ibm this is a work around code to submit a jcl with a member that has a dollar sign in it($#JCLCAI)’

i’m trying to get the output the only output i can get is the stc jobid  
i need all the output JESMSGLG, JESJCL, JESYSMSG can you help.

vars:  
vars:  
pdse\_member: ‘SYS2.DR.VERIFY.JCL($#JCLCAI)’

tasks:

```
- name: use ZOAU jsub to sumbit "{{pdse_member}}"
  ansible.builtin.shell: jsub "{{pdse_member}}"
  register: result

- name: result
  ansible.builtin.debug:
    var: result

- name: set job id variable for reuse.
  ansible.builtin.set_fact:
    job_id: "{{ result.stdout }}"

- name: get the job output  
  zos_job_output:
    job_id: "{{ job_id }}"
    register: result
    until: result.jobs[0].ret_code.msg_code
    retries: 5
    delay: 10

```

ok: [[smtsftp.dtcc.com](http://smtsftp.dtcc.com)] =\> {  
“result”: {  
“changed”: true,  
“cmd”: “jsub "SYS2.DR.VERIFY.JCL(\$#JCLCAI)"”,  
“delta”: “0:00:00.150194”,  
“end”: “2024-06-18 22:44:57.099868”,  
“failed”: false,  
“msg”: “”,  
“rc”: 0,  
“start”: “2024-06-18 22:44:56.949674”,  
“stderr”: “”,  
“stderr\_lines”: ,  
“stdout”: “J0011857”,  
“stdout\_lines”: [  
“J0011857”  
]  
}  
}  
TASK [set job id variable for reuse.] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [[smtsftp.dtcc.com](http://smtsftp.dtcc.com)]  
TASK [get the job output] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [[smtsftp.dtcc.com](http://smtsftp.dtcc.com)]  
PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
[smtsftp.dtcc.com](http://smtsftp.dtcc.com) : ok=4 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

---

<div class="post-metadata">

**Author:** ![ddimatos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ddimatos/32/1040_2.png) [@ddimatos](https://forum.ansible.com/u/ddimatos)\
**Post date:** [June 21, 2024, 3:23pm UTC](https://forum.ansible.com/t/use-zoau-jsub-to-submit-jcl/6687/2 "2024-06-21T15:23:19Z")

</div>

Hello @U6crgb0 - I supplied that work around you shared above. Your support case had a playbook attached `zos_special_char_workaround_2.yml` , in that playbook the very last debug statement is not shown in your example above that would have printed out the full job log assuming the job completed within the 5 retries with a 10 second delay. For reference I will also include the contents of that playbook here.

To see the full job output, append this to your playbook:

```auto
    - name: Result
      ansible.builtin.debug:
        var: result

```

The full playbook was:

```auto
---
- hosts: zvm
  collections:
    - ibm.ibm_zos_core
  gather_facts: false
  environment: "{{ environment_vars }}"
  vars:
    pdse_member: 'IMSTESTL.DIMATO.JCLCOPY(\$#JCLMEM)'

  tasks:
    - name: Use ZOAU jsub to submit "{{ pdse_member }}"
      ansible.builtin.shell: jsub "{{ pdse_member }}"
      register: result

    - name: Result
      ansible.builtin.debug:
        var: result

    - name: Set Job ID variable for reuse.
      ansible.builtin.set_fact:
        job_id: "{{ result.stdout }}"

    - name: Get the Job output
      zos_job_output:
        job_id: "{{ job_id }}"
      register: result
      until: result.jobs[0].ret_code.msg_code
      retries: 5
      delay: 10

    - name: Result
      ansible.builtin.debug:
        var: result

```

---

<div class="post-metadata">

**Author:** ![U6crgb0](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@U6crgb0](https://forum.ansible.com/u/U6crgb0)\
**Post date:** [July 1, 2024, 12:44pm UTC](https://forum.ansible.com/t/use-zoau-jsub-to-submit-jcl/6687/3 "2024-07-01T12:44:41Z")

</div>

keep getting this error

ok: [[smtsftp.dtcc.com](http://smtsftp.dtcc.com)] =\> {

9

“result”: {

10

“changed”: true,

11

“cmd”: “jsub "SYS2.DR.VERIFY.JCL(\$#JCLCAI)"”,

12

“delta”: “0:00:00.208560”,

13

“end”: “2024-07-01 12:31:18.629809”,

14

“failed”: false,

15

“msg”: “”,

16

“rc”: 0,

17

“start”: “2024-07-01 12:31:18.421249”,

18

“stderr”: “”,

19

“stderr\_lines”: ,

20

“stdout”: “J0022206”,

21

“stdout\_lines”: [

22

“J0022206”

23

]

24

}

25

}

26

27

TASK [set job id variable for reuse.] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*07:31:18

28

ok: [[smtsftp.dtcc.com](http://smtsftp.dtcc.com)]

29

30

TASK [get the job output] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*07:31:18

31

fatal: [[smtsftp.dtcc.com](http://smtsftp.dtcc.com)]: FAILED! =\> {“changed”: false, “msg”: “Unsupported parameters for (zos\_job\_output) module: delay, register, retries, until. Supported parameters include: ddname, job\_id, job\_name, owner.”}

---

<div class="post-metadata">

**Author:** ![ddimatos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ddimatos/32/1040_2.png) [@ddimatos](https://forum.ansible.com/u/ddimatos)\
**Post date:** [July 5, 2024, 2:51am UTC](https://forum.ansible.com/t/use-zoau-jsub-to-submit-jcl/6687/4 "2024-07-05T02:51:05Z")

</div>

Hi , formatting with code tags makes easier to diagnose and sharing your playbook within source format tags as well.

Since I have not seen your playbook, I am assuming the error is that you have under indented keywords, review the example shared in the thread to see the proper alignment for the keywords below:

> delay, register, retries,until

```auto
    - name: Get the Job output
      zos_job_output:
        job_id: "{{ job_id }}"
      register: result
      until: result.jobs[0].ret_code.msg_code
      retries: 5
      delay: 10

```
