ibm.ibm_zos_core.zos_tso_command (1.9.0) — module

Execute TSO commands

| "added in version" 1.1.0 of ibm.ibm_zos_core"

Authors: Xiao Yuan Ma (@bjmaxy), Rich Parker (@richp405), Demetrios Dimatos (@ddimatos)

Install collection

Install with ansible-galaxy collection install ibm.ibm_zos_core:==1.9.0


Add to requirements.yml

  collections:
    - name: ibm.ibm_zos_core
      version: 1.9.0

Description

Execute TSO commands on the target z/OS system with the provided options and receive a structured response.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute TSO commands to allocate a new dataset.
  zos_tso_command:
    commands:
      - alloc da('TEST.HILL3.TEST') like('TEST.HILL3')
      - delete 'TEST.HILL3.TEST'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute TSO command List User (LU) for TESTUSER to obtain TSO information.
  zos_tso_command:
    commands:
      - LU TESTUSER
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute TSO command List Dataset (LISTDSD) and allow for maximum return code of 4.
  zos_tso_command:
    commands:
      - LISTDSD DATASET('HLQ.DATA.SET') ALL GENERIC
    max_rc: 4
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute TSO command to run a REXX script explicitly from a data set.
  zos_tso_command:
    commands:
      - EXEC HLQ.DATASET.REXX exec
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Chain multiple TSO commands into one invocation using semicolons.
  zos_tso_command:
    commands: >-
      ALLOCATE DDNAME(IN1) DSNAME('HLQ.PDSE.DATA.SRC(INPUT)') SHR;
      ALLOCATE DDNAME(OUT1) DSNAME('HLQ.PDSE.DATA.DEST(OUTPUT)') SHR;
      OCOPY INDD(IN1) OUTDD(OUT1) BINARY;

Inputs

    
max_rc:
    default: 0
    description:
    - Specifies the maximum return code allowed for a TSO command.
    - If more than one TSO command is submitted, the I(max_rc) applies to all TSO commands.
    required: false
    type: int

commands:
    aliases:
    - command
    description:
    - One or more TSO commands to execute on the target z/OS system.
    - Accepts a single string or list of strings as input.
    - If a list of strings is provided, processing will stop at the first failure, based
      on rc.
    required: true
    type: raw

Outputs

output:
  contains:
    command:
      description: The executed TSO command.
      returned: always
      type: str
    content:
      description: The response resulting from the execution of the TSO command.
      returned: always
      sample:
      - NO MODEL DATA SET                                                OMVSADM
      - 'TERMUACC                                                                '
      - 'SUBGROUP(S)= VSAMDSET SYSCTLG  BATCH    SASS     MASS     IMSGRP1       '
      - '             IMSGRP2  IMSGRP3  DSNCAT   DSN120   J42      M63           '
      - '             J91      J09      J97      J93      M82      D67           '
      - '             D52      M12      CCG      D17      M32      IMSVS         '
      - '             DSN210   DSN130   RAD      CATLG4   VCAT     CSP           '
      type: list
    lines:
      description: The line number of the content.
      returned: always
      type: int
    max_rc:
      description:
      - Specifies the maximum return code allowed for a TSO command.
      - If more than one TSO command is submitted, the I(max_rc) applies to all TSO
        commands.
      returned: always
      sample: 0
      type: int
    rc:
      description: The return code from the executed TSO command.
      returned: always
      sample: 0
      type: int
  description: List of each TSO command output.
  elements: dict
  returned: always
  type: list