member_delete

This building block deletes artifacts from a PDS.

It is run on the artifacts that are listed under the step that it implements in The deployment plan.

To trigger the execution of this building block, you can enter the following code in the deployment method from which the deployment plan is generated. See How to trigger the execution of a building block. The following code is an example.
actions:
    - name: DELETE ARTIFACTS FROM A PDS
      short_name: DELETE_ARTIFACTS
      steps:
      - name: TEST FOR MEMBER_DELETE
        short_name: TEST_DELETE
        properties:
        - key: template
          value: member_delete

types:
  - name: 'LOAD'
  - name: 'DBRM'
  - name: 'CICSLOAD'
  - name: 'JCL'
is_artifact: True
This building block is related to the following artifact types:
  • Load module, CICS load module, DBRM, and JCL for CICS Db2 applications
  • IMS load module, Message Format Service (MFS) source, IMS program specification block (PSB), and IMS database descriptor (DBD) for IMS applications
The names that you give to these artifact types correspond to the extensions of these artifacts in the package file. You can freely choose these extension names.

To run correctly, this building block requires environment variables. Indicate them in a .yml file. Indicate The generic environment variables for the Ansible and Python building blocks and adapt their values to your target z/OS environment. Indicate also the variables that are specific to this building block.

The Ansible variables

To run this building block, indicate the following specific variables in an Ansible environment variables file:
common_pds_load_spec:
  type: LIBRARY
  space_primary: 10
  space_secondary: 20
  space_type: CYL
  record_format: U
  record_length: 0

common_pds_binary_spec:
  type: LIBRARY
  space_primary: 10
  space_secondary: 20
  space_type: CYL
  record_format: FB
  record_length: 80
  
common_pds_text_spec:
  type: LIBRARY
  space_primary: 5
  space_secondary: 10
  space_type: CYL
  record_format: FB
  record_length: 80


hlq: 'NAZARE.WDEPLOY.ANSIBLE'

default_types: 'types'
default_copy_by_folder: False

types:
  - type: 'LOAD'
    copy_by_folder: '{{default_copy_by_folder}}'
    pds: 
      name: '{{ hlq }}.LOADLIB'
      spec: "{{common_pds_load_spec}}"
      backup: '{{ hlq }}.BACK.LOADLIB'
    is_load: True
    aliases: True
    force_lock: True
#   use_native_copy : True
#   native_copy_options: "-X"
  - type: 'DBRM'
    copy_by_folder: '{{default_copy_by_folder}}'
    pds: 
      name: '{{ hlq }}.DBRM'
      spec: "{{common_pds_binary_spec}}"
      backup: '{{ hlq }}.BACK.DBRM'
    is_binary: True 
    force_lock: True
#   use_native_copy : True
  - type: 'CICSLOAD'
    copy_by_folder: '{{default_copy_by_folder}}'
    pds: 
      name: '{{ hlq }}.LOADLIB'
      spec: "{{common_pds_load_spec}}"
      backup: '{{ hlq }}.BACK.LOADLIB'
    is_load: True
    aliases: True
    force_lock: True
#   use_native_copy : True
#   native_copy_options: "-X" 
  - type: 'JCL'
    copy_by_folder: '{{default_copy_by_folder}}'
    pds: 
      name: '{{ hlq }}.JCL'
      spec: "{{common_pds_text_spec}}"
      backup: '{{ hlq }}.BACK.JCL'
    force_lock: True
    encoding:
      from: UTF-8
      to: IBM-1047
#   use_native_copy : True
Among all the variables that are shown in this extract, only some of them are used by this building block. The other variables are included so that you can copy and paste all the variables that might be relevant for other building blocks. To run this building block, you must declare the following variables:
  • The variables related to the artifact types.

    Enter the name of the root that lists the types and characteristics of the artifacts to be deployed, if the building block applies to artifacts. By default, the root name is types but you can enter any other name if you define a var_type property in the deployment method step that is implemented by the building block. See The types variable.

    Under this root, create a type variable for each artifact type that relates to this building block in the generated deployment plan. The value of each artifact type comes from the deployment method, where it is freely chosen.

    For each type variable, enter the following variables:
    • A pds variable with the name of the PDS to be deleted.
    • A rename_subs variable if you want to rename some artifacts for the deployment. Then, the building block will process these artifacts under names that are different from the names in the application package.
      In the following example, pattern and replace are regular expressions.
      - type: 'JCL'
        copy_by_folder: '{{default_copy_by_folder}}'
        pds:
          name: '{{ hlq }}.JCL'
          spec: "{{common_pds_text_spec}}"
          backup: '{{ hlq }}.BACK.JCL'
        encoding:
          from: UTF-8
          to: IBM-1047
        rename_subs:
        - pattern: "CDRD(.*)"
          replace: "CDRP\1"

The Python variables

To run this building block, indicate the following specific variables in a Python environment variables file. The whole path to this file is indicated in the --envFile argument of The Python deployment command.

common_pds_load_spec:
   type: LIBRARY
   primary_space: 10CYL
   secondary_space: 20CYL
   record_format: U
   record_length: 0
common_pds_binary_spec:
   type: LIBRARY
   primary_space: 10CYL
   secondary_space: 20CYL
   record_format: FB
   record_length: 80
common_pds_txt_spec:
   type: LIBRARY
   primary_space: 10CYL
   secondary_space: 20CYL
   record_format: FB
   record_length: 80

hlq: 'NAZARE.WDEPLOY.PYTHON'
  
types:
  - pattern: .*\.LOAD$
    dataset: "{{ hlq }}.LOADLIB"
    dataset_backup: "{{ hlq }}.BACK.LOADLIB"
    spec: "{{ common_pds_load_spec }}"
    is_load: True
    aliases: True
    force_lock: True
#   use_native_copy : True
#   native_copy_options: "-X"
  - pattern: .*\.CICSLOAD$
    dataset: "{{ hlq }}.LOADLIB"
    dataset_backup: "{{ hlq }}.BACK.LOADLIB"
    spec: "{{ common_pds_load_spec }}"
    is_load: True
    aliases: True
    force_lock: True
#   use_native_copy : True
#   native_copy_options: "-X"
  - pattern: .*.DBRM$
    dataset: "{{ hlq }}.DBRM"
    dataset_backup: "{{ hlq }}.BACK.DBRM"
    spec: "{{ common_pds_binary_spec }}"
    is_binary: True
    force_lock: True
#   use_native_copy : True
  - pattern: .*.JCL$
    dataset: "{{ hlq }}.JCL"
    dataset_backup: "{{ hlq }}.BACK.JCL"
    spec: "{{ common_pds_txt_spec }}"
    force_lock: True
    encoding:
      from: UTF-8
      to: IBM-1047
#   use_native_copy : True
Among all the variables that are shown in this extract, only some of them are used by this building block. The other variables are included so that you can copy and paste all the variables that might be relevant for other building blocks. To run this building block, you must declare the following variables:
  • The variables related to the artifact types.

    Enter the name of the root that lists the types and characteristics of the artifacts to be deployed, if the building block applies to artifacts. By default, the root name is types but you can enter any other name if you define a var_type property in the deployment method step that is implemented by the building block. See The types variable.

    Under this root, create a pattern variable for each artifact type that relates to this building block in the deployment plan. The value of each artifact type comes from the deployment method, where it is freely chosen. A pattern is a regular expression that selects the artifacts from their path in The application manifest file.

    For each pattern variable, enter the following variables:
    • A dataset variable with the name of the data set to be deleted.
    • A rename_subs variable if you want to rename some artifacts for the deployment. Then, the building block will process these artifacts under names that are different from the names in the application package.
      In the following example, pattern and replace are regular expressions.
        - pattern: .\*.JCL$
          dataset: "{{ hlq }}.JCL"
          dataset_backup: "{{ hlq }}.BACK.JCL"
          spec: "{{ common_pds_txt_spec }}"
          encoding:
            from: UTF-8
            to: IBM-1047
          rename_subs:
          - pattern: "CDRD(.*)"
            replace: "CDRP\1"

Return values

The result of each building block task is displayed in the evidence file, in The results level that is embedded in step_result.