Skip to content

[Bug] [zos_copy] [module_utils/data_set] Command used in alias search is too long #2389

@rexemin

Description

@rexemin

Is there an existing issue for this?

  • There are no existing issues.

Bug description

A user reported that when trying to copy a data set with a 44 character name, the module would fail during a check to see if it is an alias. The error is that a the whole MVS command is longer than 71 characters, resulting in it being cutoff.

The command is executed by placing it inside a temporary data set in the method _execute_idcams_cmd that gets called by get_name_if_data_set_is_alias in the data_set.py util, so the fix should just be to break up the command into multiple lines before writing it into the data set.

The command is set inside get_name_if_data_set_is_alias:
idcams_cmd = f" LISTCAT ALIAS ENTRIES('{name}')ALL"

IBM z/OS Ansible core Version

v1.15.0

IBM Z Open Automation Utilities

v1.3.5

IBM Enterprise Python

v3.11.x

ansible-version

v2.15.x

z/OS version

v2.5

Ansible module

zos_copy

Playbook verbosity output.

The following output has been sanitized. The data set name retains its original length.

TASK [*********]
*************************************************************************************************************************************
fatal: [****]: FAILED! => {"changed": false, "msg": "MODULE FAILURE: No start of
json char found\nSee stdout/stderr for the exact error", "rc": 1, "stderr":
"Traceback (most recent call last):\n  File \"<stdin>\", line 107, in <module>\n
File \"<stdin>\", line 99, in _ansiballz_main\n  File \"<stdin>\", line 47, in
invoke_module\n  File \"<frozen runpy>\", line 226, in run_module\n  File
\"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\",
line 88, in _run_code\n  File
\"/tmp/ansible_ibm.ibm_zos_core.zos_copy_payload_24rls3_p/ansible_ibm.ibm_zos_core.zos_copy_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_copy.py\",
line 4347, in <module>\n  File
\"/tmp/ansible_ibm.ibm_zos_core.zos_copy_payload_24rls3_p/ansible_ibm.ibm_zos_core.zos_copy_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_copy.py\",
line 4201, in main\n  File
\"/tmp/ansible_ibm.ibm_zos_core.zos_copy_payload_24rls3_p/ansible_ibm.ibm_zos_core.zos_copy_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_copy.py\",
line 3433, in run_module\n  File
\"/tmp/ansible_ibm.ibm_zos_core.zos_copy_payload_24rls3_p/ansible_ibm.ibm_zos_core.zos_copy_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/data_set.py\",
line 2196, in
get_name_if_data_set_is_alias\nansible_collections.ibm.ibm_zos_core.plugins.module_utils.data_set.MVSCmdExecError:
Failure during execution of mvscmd; Return code: 12; stdout: 1IDCAMS  SYSTEM
SERVICES                                           TIME: 10:41:35
10/28/25     PAGE      1\n0        \n  LISTCAT ALIAS
ENTRIES('********.****.******.********.******.*******')ALL\n0IDC3211I KEYWORD
'AL' IS IMPROPER\n0IDC3202I ABOVE TEXT BYPASSED UNTIL NEXT COMMAND. CONDITION
CODE IS 12\n0        \n0IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION
CODE WAS 12\n; stderr: \n", "stderr_lines": null, "stdout": "", "stdout_lines":
null}

Ansible configuration.

Contents of the inventory

Contents of group_vars or host_vars

Metadata

Metadata

Assignees

Labels

BugSomething isn't working as designed.Post plan issueAdded to a quarter after planning was completed, thus unplanned.Was triagedAn item that went through the triage process.

Type

Projects

Status

🔍 Validation

Relationships

None yet

Development

No branches or pull requests

Issue actions