ibm.ibm_zos_core.zos_job_query (1.9.0) — module

Query job status

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

Authors: Ping Xiao (@xiaopingBJ), Demetrios Dimatos (@ddimatos), Rich Parker (@richp405)

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

List z/OS job(s) and the current status of the job(s).

Uses job_name to filter the jobs by the job name.

Uses job_id to filter the jobs by the job identifier.

Uses owner to filter the jobs by the job owner.

Uses system to filter the jobs by system where the job is running (or ran) on.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query a job with a job name of 'JOB12345'
  zos_job_query:
    job_name: "JOB12345"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query jobs using a wildcard to match any job id begging with 'JOB12'
  zos_job_query:
    job_id: "JOB12*"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query jobs using wildcards to match any job name begging with 'H' and ending in 'O'.
  zos_job_query:
    job_name: "H*O"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query jobs using a wildcards to match a range of job id(s) that include 'JOB' and '014'.
  zos_job_query:
    job_id: JOB*014*
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query all job names beginning wih 'H' that match job id that includes '14'.
  zos_job_query:
    job_name: "H*"
    job_id: "JOB*14*"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query all jobs names beginning with 'LINK' for owner 'ADMIN'.
  zos_job_query:
    job_name: "LINK*"
    owner: ADMIN

Inputs

    
owner:
    description:
    - Identifies the owner of the job.
    - If no owner is set, the default set is 'none' and all jobs will be queried.
    required: false
    type: str

job_id:
    description:
    - The job id that has been assigned to the job.
    - A job id must begin with `STC`, `JOB`, `TSU` and are followed by up to 5 digits.
    - When a job id is greater than 99,999, the job id format will begin with `S`, `J`,
      `T` and are followed by 7 digits.
    - The I(job_id) can contain include multiple wildcards.
    - The asterisk (`*`) wildcard will match zero or more specified characters.
    required: false
    type: str

job_name:
    default: '*'
    description:
    - The job name to query.
    - A job name can be up to 8 characters long.
    - The I(job_name) can contain include multiple wildcards.
    - The asterisk (`*`) wildcard will match zero or more specified characters.
    required: false
    type: str

Outputs

changed:
  description: True if the state was changed, otherwise False.
  returned: always
  type: bool
jobs:
  contains:
    asid:
      description: The address Space Identifier (ASID) that is a unique descriptor
        for the job address space. Zero if not active.
      sample: 0
      type: int
    creation_date:
      description: Date, local to the target system, when the job was created.
      sample: '2023-05-04'
      type: str
    creation_time:
      description: Time, local to the target system, when the job was created.
      sample: '14:15:00'
      type: str
    job_class:
      description: Job class for this job.
      sample: A
      type: str
    job_id:
      description: Unique job identifier assigned to the job by JES.
      sample: JOB01427
      type: str
    job_name:
      description: The name of the batch job.
      sample: LINKJOB
      type: str
    owner:
      description: The owner who ran the job.
      sample: ADMIN
      type: str
    priority:
      description: A numeric indicator of the job priority assigned through JES.
      sample: 4
      type: int
    program_name:
      description: The name of the program found in the job's last completed step
        found in the PGM parameter. Returned when Z Open Automation Utilities (ZOAU)
        is 1.2.4 or later.
      sample: IEBGENER
      type: str
    queue_position:
      description: The position within the job queue where the jobs resides.
      sample: 3
      type: int
    ret_code:
      contains:
        code:
          description: Return code converted to integer value (when possible).
          sample: 0
          type: int
        msg:
          description: Return code or abend resulting from the job submission.
          sample: CC 0000
          type: str
        msg_code:
          description: Return code extracted from the `msg` so that it can be evaluated.
            For example, ABEND(S0C4) would yield "S0C4".
          sample: S0C4
          type: str
        msg_txt:
          description: Returns additional information related to the job.
          sample: 'No job can be located with this job name: HELLO'
          type: str
        steps:
          contains:
            step_cc:
              description: The CC returned for this step in the DD section.
              sample: 0
              type: int
            step_name:
              description: Name of the step shown as "was executed" in the DD section.
              sample: STEP0001
              type: str
          description: Series of JCL steps that were executed and their return codes.
          elements: dict
          type: list
      description: Return code output collected from job log.
      sample:
        ret_code:
          code: 0
          msg: CC 0000
          msg_code: '0000'
          msg_txt: ''
          steps:
          - step_cc: 0
            step_name: STEP0001
      type: dict
    svc_class:
      description: Service class for this job.
      sample: C
      type: str
  description: The output information for a list of jobs matching specified criteria.
    If no job status is found, this will return ret_code dictionary with parameter
    msg_txt = The job could not be found.
  elements: dict
  returned: success
  sample:
  - asid: 0
    creation_date: '2023-05-03'
    creation_time: '12:13:00'
    job_class: K
    job_id: JOB01427
    job_name: LINKJOB
    owner: ADMIN
    priority: 1
    queue_position: 3
    ret_code: 'null'
    svc_class: '?'
  - asid: 4
    creation_date: '2023-05-03'
    creation_time: '12:14:00'
    job_class: A
    job_id: JOB16577
    job_name: LINKCBL
    owner: ADMIN
    priority: 0
    queue_position: 0
    ret_code:
      code: 'null'
      msg: CANCELED
    svc_class: E
  type: list
message:
  description: Message returned on failure.
  returned: failure
  sample:
    msg: 'List FAILED! no such job been found: IYK3Z0R9'
  type: str