Use zoau JSUB to submit jcl

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] => {
“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]
TASK [get the job output] ******************************************************
ok: [smtsftp.dtcc.com]
PLAY RECAP *********************************************************************
smtsftp.dtcc.com : ok=4 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

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:

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

The full playbook was:

---
- 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

keep getting this error

ok: [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]

29

30

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

31

fatal: [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.”}

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

    - 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