ibm.ibm_zos_core.zos_find (1.9.0) — module

Find matching data sets

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

Authors: Asif Mahmud (@asifmahmud), 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

Return a list of data sets based on specific criteria.

Multiple criteria can be added (AND'd) together.

The C(zos_find) module can only find MVS data sets. Use the L(find,https://docs.ansible.com/ansible/latest/modules/find_module.html) module to find USS files.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Find all data sets with HLQ 'IMS.LIB' or 'IMSTEST.LIB' that contain the word 'hello'
  zos_find:
    patterns:
      - IMS.LIB.*
      - IMSTEST.LIB.*
    contains: 'hello'
    age: 2d
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Search for 'rexx' in all datasets matching IBM.TSO.*.C??
  zos_find:
    patterns:
      - IBM.TSO.*.C??
    contains: 'rexx'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Exclude data sets that have a low level qualifier 'TEST'
  zos_find:
    patterns: 'IMS.LIB.*'
    contains: 'hello'
    excludes: '*.TEST'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Find all members starting with characters 'TE' in a given list of PDS patterns
  zos_find:
    patterns: '^te.*'
    pds_patterns:
      - IMSTEST.TEST.*
      - IMSTEST.USER.*
      - USER.*.LIB
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Find all data sets greater than 2MB and allocated in one of the specified volumes
  zos_find:
    patterns: 'USER.*'
    size: 2m
    volumes:
      - SCR03
      - IMSSUN
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Find all VSAM clusters starting with the word 'USER'
  zos_find:
    patterns:
      - USER.*
    resource_type: cluster

Inputs

    
age:
    description:
    - Select data sets whose age is equal to or greater than the specified time.
    - Use a negative age to find data sets equal to or less than the specified time.
    - You can choose days, weeks, months or years by specifying the first letter of any
      of those words (e.g., "1w"). The default is days.
    - Age is determined by using the 'referenced date' of the data set.
    required: false
    type: str

size:
    description:
    - Select data sets whose size is equal to or greater than the specified size.
    - Use a negative size to find files equal to or less than the specified size.
    - Unqualified values are in bytes but b, k, m, g, and t can be appended to specify
      bytes, kilobytes, megabytes, gigabytes, and terabytes, respectively.
    - Filtering by size is currently only valid for sequential and partitioned data sets.
    required: false
    type: str

volume:
    aliases:
    - volumes
    description:
    - If provided, only the data sets allocated in the specified list of volumes will
      be searched.
    elements: str
    required: false
    type: list

contains:
    description:
    - A string which should be matched against the data set content or data set member
      content.
    required: false
    type: str

excludes:
    aliases:
    - exclude
    description:
    - Data sets whose names match an excludes pattern are culled from patterns matches.
      Multiple patterns can be specified using a list.
    - The pattern can be a regular expression.
    - If the pattern is a regular expression, it must match the full data set name.
    elements: str
    required: false
    type: list

patterns:
    description:
    - One or more data set or member patterns.
    - The patterns restrict the list of data sets or members to be returned to those names
      that match at least one of the patterns specified. Multiple patterns can be specified
      using a list.
    - This parameter expects a list, which can be either comma separated or YAML.
    - If C(pds_patterns) is provided, C(patterns) must be member patterns.
    - When searching for members within a PDS/PDSE, pattern can be a regular expression.
    elements: str
    required: true
    type: list

age_stamp:
    choices:
    - creation_date
    - ref_date
    default: creation_date
    description:
    - Choose the age property against which to compare age.
    - C(creation_date) is the date the data set was created and C(ref_date) is the date
      the data set was last referenced.
    - C(ref_date) is only applicable to sequential and partitioned data sets.
    required: false
    type: str

pds_patterns:
    aliases:
    - pds_paths
    - pds_pattern
    description:
    - List of PDS/PDSE to search. Wildcard is possible.
    - Required when searching for data set members.
    - Valid only for C(nonvsam) resource types. Otherwise ignored.
    elements: str
    required: false
    type: list

resource_type:
    choices:
    - nonvsam
    - cluster
    - data
    - index
    default: nonvsam
    description:
    - The type of resource to search.
    - C(nonvsam) refers to one of SEQ, LIBRARY (PDSE), PDS, LARGE, BASIC, EXTREQ, or EXTPREF.
    - C(cluster) refers to a VSAM cluster. The C(data) and C(index) are the data and index
      components of a VSAM cluster.
    required: false
    type: str

Outputs

data_sets:
  description: All matches found with the specified criteria.
  returned: success
  sample:
  - members:
      COBU: null
      MC2CNAM: null
      TINAD: null
    name: IMS.CICS13.USERLIB
    type: NONVSAM
  - name: SAMPLE.DATA.SET
    type: CLUSTER
  - name: SAMPLE.VSAM.DATA
    type: DATA
  type: list
examined:
  description: The number of data sets searched.
  returned: success
  sample: 158
  type: int
matched:
  description: The number of matched data sets found.
  returned: success
  sample: 49
  type: int
msg:
  description: Failure message returned by the module.
  returned: failure
  sample: Error while gathering data set information
  type: str
rc:
  description: The return code of a USS or MVS command, if applicable.
  returned: failure
  sample: 8
  type: int
stderr:
  description: The stderr of a USS command or MVS command, if applicable.
  returned: failure
  sample: No such file or directory "/tmp/foo"
  type: str
stdout:
  description: The stdout from a USS command or MVS command, if applicable.
  returned: failure
  sample: Searching dataset IMSTESTL.COMNUC
  type: str

See also