broadcom.dbm_db2.generate_ddl (1.27.2) — module

Generate CREATE or DROP DDL statements for specified Db2 objects into an output DDL file

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

Generate CREATE or DROP DDL statements for specified Db2 objects into an output DDL file. For example, use this command to generate CREATE TABLE definitions that you can then edit and use to update the table definition on a Db2 subsystem with the 'zowe dbm compare ddl' command.

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: Generate CREATE DDL statements for a tablespace and its child table
  broadcom.dbm_db2.generate_ddl:
    object: tablespace my.tbsp include(table)
    source_db2: SRC
    output_ddl_file: objects.sql
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Generate CREATE DDL statements for a database and its children and apply changes as defined in the change set
  broadcom.dbm_db2.generate_ddl:
    object: database my.db include(children)
    source_db2: SRC
    change_set: USER1.CHANGSET
    output_ddl_file: objects.sql
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Generate DROP DDL statements only for the input object list
  broadcom.dbm_db2.generate_ddl:
    object_file: objects.txt
    source_db2: SRC
    type: drop
    output_ddl_file: output.sql

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

type:
    choices:
    - drop
    - create
    default: create
    description:
    - Specifies the type of DDL statements that you want to generate. You can generate
      CREATE or DROP statements.
    required: false
    type: str

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

sqlid:
    description:
    - Specifies the authorization ID that is used as the value in generated SET CURRENT
      SQLID statements most of the time.
    required: false
    type: str

authid:
    description:
    - Specifies the primary Db2 authorization ID (user ID) that is used to establish a
      connection between Db2 and a process.
    required: false
    type: str

object:
    description:
    - Specifies the Db2 objects for which you want to generate DDL statements. Use the
      optional include syntax to include related Db2 objects.
    - '     '
    - 'Format: see object-file description.'
    - ''
    - 'Note: The and options are mutually exclusive. '
    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

change_set:
    description:
    - Specifies the creator and name of an existing RC/Migrator global change set to be
      used to modify Db2 object attributes when generating the DDL.
    - ''
    - 'Format:'
    - ''
    - '<change-set-creator.change-set-name> '
    - ''
    - For more information about global change services, see the RC/Migrator documentation
      at https://techdocs.broadcom.com/db2rcmig
    - ''
    - 'Note: If change-set and change-set-file are both specified, specifications in change-set-file
      take precedence. '
    required: false
    type: str

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

source_db2:
    description:
    - Specifies the source Db2 subsystem or the data sharing group where the objects that
      you want to generate DDL for are located.
    - ''
    - ' Note: If you specify the data sharing group, the first active Db2 subsystem in
      the group is used. '
    required: true
    type: str

object_file:
    description:
    - Specifies the local input file that contains a list of Db2 objects, separated by
      a semicolon, for which you want to generate DDL statements. Use the optional include
      syntax to include related Db2 objects.
    - '     '
    - 'Format:'
    - ''
    - <object-type> <object-name> [include(<related-object-type>,...)];
    - ''
    - 'The required clause <object-type> <object-name>  identifies the specific Db2 (base)
      object:'
    - '    '
    - STOGROUP <name>
    - DATABASE <name>
    - TABLESPACE <dbname.name>
    - TABLE <schema.name>
    - INDEX <schema.name>
    - VIEW <schema.name>
    - ALIAS <schema.name>
    - SYNONYM <schema.name>
    - MQT <schema.name>
    - SEQUENCE <schema.name>
    - TRIGGER <schema.name>
    - FUNCTION <schema.name[.version]>
    - PROCEDURE <schema.name[.version]>
    - ''
    - The optional clause include(<related-object-type>,...) identifies one or more, comma
      separated related object types that you want to include in the generated DDL statements.
      You can specify STOGROUP, DATABASE, TABLESPACE, TABLE, INDEX, VIEW, SYNONYM, MQT-ALL,
      TRIGGER, ROUTINE, PARENTS, CHILDREN, and ALL.
    - '    '
    - 'Example:'
    - '    '
    - table sysibm.systables include (tablespace, database, index);
    - database db1 include(children);
    - ''
    - 'Note: The and options are mutually exclusive. '
    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

change_set_file:
    description:
    - Specifies the name of the local input file that contains the global change specifications
      to modify Db2 object attributes when generating DDL.
    - ''
    - 'Format:'
    - ''
    - <object-attribute> <from-value> <to-value>
    - '   '
    - The <object-attribute> consists of four characters. The first two characters identify
      the object type. The last two characters identify the specific attribute. Wildcard
      characters are supported in the <from-value> and <to-value>. The first occurrence
      in multiple specifications for the same <object-attribute> has the highest precedence.
    - '  '
    - For a list of global change set attributes, see the RC/Migrator documentation at
      https://techdocs.broadcom.com/db2rcmig
    - ''
    - 'Example:'
    - '   '
    - "The following example demonstrates changes to table\u2019s schema (creator) and\
      \ tablespace names:"
    - '    '
    - TBCR TEST% PROD%
    - TBTS TESTTS% PRODTS%
    - ''
    - 'Note: If change-set and change-set-file are both specified, specifications in change-set-file
      take precedence. '
    required: false
    type: str

output_ddl_file:
    description:
    - Specifies the local output file name that contains the generated DDL for the objects
      that are identified by the or option.
    - '     '
    - 'Default value: output.sql '
    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

termination_character:
    description:
    - Specifies the SQL termination character that you want to use to terminate object
      DDL for triggers, XML indexes, functions, and procedures that contain embedded semicolon-terminated
      SQL statements. You cannot use a comma, an underscore, a single quote, double quotes,
      left parentheses, or right parentheses for this value.
    required: false
    type: str

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

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