broadcom.dbm_db2.execute_script (1.27.2) — module

Execute a Batch Processor script on a target subsystem

| "added in version" 1.0.0 of broadcom.dbm_db2"

Authors: Rabah Beggar <rabah.beggar@broadcom.com> (@broadcom), Sergei Osadchuk <sergei.osadchuk@broadcom.com> (@broadcom)

| supported by Broadcom

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install broadcom.dbm_db2:==1.27.2


Add to requirements.yml

  collections:
    - name: broadcom.dbm_db2
      version: 1.27.2

Description

Execute a Batch Processor script on a target subsystem. For example, use this command to execute a Batch Processor script or specifically to execute a recovery script to undo changes that were made by the 'zowe dbm execute compare-script' command. If execution of the script fails, you can execute it again using the 'script-section' or 'restart' options. You can edit the script and make changes before you execute or restart it.

For details about command usage for automation, see DBM-Db2 samples at https://github.com/BroadcomMFD/dbm-db2-for-zowe-cli

.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute a recovery script
  broadcom.dbm_db2.execute_script:
    local_input_bp_script_filename: recovery.txt
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute a script on the 'TEST' Db2 subsystem
  broadcom.dbm_db2.execute_script:
    local_input_bp_script_filename: script001.txt
    target_db2: TEST
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute only the SQLDDL section of a script. The first .CONNECT statement in the script identifies the target subsystem where the script is executed. Execution begins at the .SYSTEM SQLDDL statement and ends at the next .SYSTEM statement in the script
  broadcom.dbm_db2.execute_script:
    local_input_bp_script_filename: script001.txt
    script_section: SQLDDL
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute a script beginning from the sync point 10 (.SYNC 10 statement) to the end of the script
  broadcom.dbm_db2.execute_script:
    local_input_bp_script_filename: script001.txt
    script_section: 10
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Execute only the target (SQLDDL) section of the script starting at sync point 20
  broadcom.dbm_db2.execute_script:
    local_input_bp_script_filename: script001.txt
    script_section: target,20
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Restart execution of a script from the beginning
  broadcom.dbm_db2.execute_script:
    local_input_bp_script_filename: script001.txt
    restart: new
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Restart execution of a script at the location specified in the token. The restart token is returned by a previous 'zowe dbm execute command' failure as part of the terminal output and in the error file
  broadcom.dbm_db2.execute_script:
    local_input_bp_script_filename: script001.txt
    restart: 78A724A48DA5185D06FD140F6780D6FA
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Restart execution at the last successful sync point recorded in the restart token up to the end of the target (SQLDDL) section
  broadcom.dbm_db2.execute_script:
    local_input_bp_script_filename: script001.txt
    restart: target,78A724A48DA5185D06FD140F6780D6FA

Inputs

    
host:
    description:
    - Host name of service on the mainframe.
    required: false
    type: str

port:
    description:
    - Port number of service on the mainframe.
    required: false
    type: int

user:
    description:
    - User name to authenticate to service on the mainframe.
    required: false
    type: str

restart:
    description:
    - 'Specifies the location in the script where you want to restart execution. The effects
      of previous successful script statement executions remain. '
    - ''
    - 'The following restart options are valid:'
    - '       '
    - new - Restart execution of the script at the first statement.
    - '        '
    - token - Restart execution of the script at the location that is recorded in the
      specified token and that was returned from a previous execution failure.
    - ''
    - name, token - Restart execution of the script at the location in the restart section
      that is recorded in the specified token and that was returned from a prior execution
      failure.
    - '       '
    - A section is a Batch Processor '.SYSTEM <name>' statement, where <name> identifies
      a logical grouping of statements such as UNLOADS or SQLDDL. 'source' is an alias
      for UNLOADS. 'target' is an alias for SQLDDL.
    required: false
    type: str

password:
    description:
    - Password to authenticate to service on the mainframe.
    required: false
    type: str

protocol:
    choices:
    - http
    - https
    description:
    - Specifies the communication protocol to use between the zowe dbm-db2 client and
      the DBM Data Service.
    required: false
    type: str

cert_file:
    description:
    - The file path to a certificate file to use for authentication.
    - ''
    - 'Note: The CLI does not support certificate files that require a password. For more
      information, search Troubleshooting PEM Certificates in Zowe Docs.'
    required: false
    type: path

job_cards:
    description:
    - Specifies a string array of z/OS JCL JOB statements.
    elements: str
    required: false
    type: list

error_file:
    description:
    - Specifies the local output error file in YAML format that contains basic execution
      information, connection details, dbm-db2 profile parameters, used arguments, and
      errors that occurred during execution of the command.
    - '      '
    - 'Default value: error.log '
    required: false
    type: str

target_db2:
    description:
    - Specifies the target Db2 subsystem or data sharing group where you want to execute
      the script. If this option is not specified, the target subsystem is identified
      by the first .CONNECT statement in the script.
    - ''
    - ' Note: If you specify the data sharing group, the first active Db2 subsystem in
      the group is used.'
    - ''
    - 'The target-db2 option takes precedence over any other value that is specified for
      the Db2 subsystem or data sharing group. '
    required: false
    type: str

modification:
    description:
    - Identifies a named set of server-managed default parameter values that control the
      execution behavior of the zowe dbm-db2 commands. For example, you can use a modification
      to identify a set of default values that differ from the set of values that are
      normally used.
    - '  '
    - For more information about using the modification option, see the DBM Data Service
      documentation at https://techdocs.broadcom.com/db2mgmt .
    required: false
    type: str

cert_key_file:
    description:
    - The file path to a certificate key file to use for authentication.
    required: false
    type: path

script_section:
    description:
    - 'Identifies the location in the script where you want to begin execution. '
    - ''
    - 'The following options are valid:'
    - ''
    - name - Begin execution of the specific section and process all subsequent statements
      up to the next section.
    - ''
    - A section is a '.SYSTEM <name>' statement, where <name> identifies a logical grouping
      of statements such as UNLOADS or SQLDDL. 'source' is an alias for UNLOADS. 'target'
      is an alias for SQLDDL.
    - ''
    - number - Begin execution after the specific sync point (.SYNC <number> statement)
      and process all statements up to the end of the script.
    - ''
    - name, number - Begin execution of the specific script section beginning from the
      sync point (.SYNC <number> statement) within the section and process all subsequent
      statements up to the next section.
    required: false
    type: str

environment_list:
    description:
    - Specifies an object of one or more values consisting of a Db2 subsystem ID and a
      DBM Data Service environment pair. The paired entry identifies the DBM Data Service
      environment to use for a subsystem that is accessible through multiple DBM Data
      Service environments. For more information about configuring the DBM Data Service,
      see the Database Management Solutions for Db2 for z/OS documentation at https://techdocs.broadcom.com/db2mgmt.
    required: false
    type: str

reject_unauthorized:
    default: true
    description:
    - Reject self-signed certificates.
    required: false
    type: bool

work_dataset_prefix:
    description:
    - Specifies the prefix that is used as the high level qualifier in z/OS work data
      set names.
    required: false
    type: str

overwrite_output_files:
    description:
    - Specifies whether to overwrite output files when they already exist.
    required: false
    type: bool

local_input_bp_script_filename:
    description:
    - Specifies the local input file that contains the Batch Processor statements such
      as the recovery script that was created by executing the 'zowe dbm execute compare-script'
      command.
    required: true
    type: str

Outputs

data:
  description: Data from the module execution (a data structure). The items of this
    dict are set as individual return values on the top level as well.
  elements: dict
  returned: when returned data is a dictionary
  type: list
error:
  contains:
    additional_details:
      description: Detailed message about the failure.
      type: str
    msg:
      description: Short description of the result or failure.
      type: str
    request:
      description: HTTP method used to invoke API service request.
      returned: API request failed
      type: str
    resource:
      description: URI of the resource of the API service request.
      returned: API request failed
      type: str
  description: More details about why the action has failed. If the failure is when
    calling an API service, the response contains the connection parameters.
  returned: error
  type: complex
failed:
  description: A boolean that indicates if the task was failed or not.
  returned: always
  type: bool
list:
  description: Data from the module execution (a list of data structures).
  elements: dict
  returned: when returned data is a list
  type: list
msg:
  description: Short description of the result or failure.
  returned: sometimes
  type: str
rc:
  description: Exit code of the module, successful exit code is 0, failure is typically
    1 or higher.
  returned: always
  type: int
stderr:
  description: Details of the error.
  returned: error
  type: str
stdout:
  description: Summary of the result.
  returned: success
  type: str