db2_bind_plan
This building block binds the DBRMs into a plan by creating the bind plan JCL and running it.
It is run on the artifacts that are listed under the step that it implements in The deployment plan.
actions:
- name: BIND THE DBRMS WITH A JCL
short_name: BIND_DBRMS
states:
- UNDEFINED
steps:
- name: TEST STEP FOR BIND_PLAN
short_name: TEST_PLAN
properties:
- key: template
value: db2_bind_plan
types:
- name: 'DBRM'
is_artifact: True
This building block is related to the following artifact type: database request module (DBRM). The name that you give to this artifact type corresponds to the extension of this artifact in the package file. You can freely choose this extension name.
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
common_pds_binary_spec:
type: LIBRARY
space_primary: 10
space_secondary: 20
space_type: CYL
record_format: FB
record_length: 80
default_plan_jobcard: "BINDPLA JOB 'WD-PLANBIND',MSGLEVEL=(1,1),MSGCLASS=R,NOTIFY=&SYSUID"
default_db2_action: "REPLACE"
default_db2_user: "{{ ansible_user }}"
db2_sys_def:
sdsnload: DSN.V12R1M0.SDSNLOAD
subsys: DBC1
qualifier: GENADB0
plan: GENAONE
sqlid: "{{default_db2_user}}"
plan_jobcard: "{{default_plan_jobcard}}"
plan_action: "{{default_db2_action}}"
plan_job_max_rc: 4
plan_pklist: '*.GENASA1.*'
default_copy_by_folder: False
hlq: 'NAZARE.WDEPLOY.ANSIBLE'
default_types: 'types'
types:
- 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
db2_systems:
- "{{ db2_sys_def }}"
- 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.
Enter the following variables for each type variable:- db2_systems
-
List
RequiredThe list of Db2® system definitions. Each Db2 system definition contains the following variables:
- plan
-
String
RequiredThe name of the bind plan.
- plan_action
-
String
RequiredThe Db2 action.
- plan_job_max_rc
-
Integer
RequiredThe maximum return code allowed for the successful completion of the
zos_job_submitmodule. See zos_job_submit..
- plan_jobcard
-
String
RequiredThe parameters of the job card for the JCL that binds the plan.
- plan_pklist
-
String
RequiredThe list of the packages to be included, with commas as separators.
- qualifier
-
String
RequiredThe
Qualifieroption of the bind.
- sdsnload
-
String
RequiredThe name of the
sdsnloadlibrary.
- sqlid
-
String
RequiredThe
Owneroption of the bind.
- subsys
-
String
RequiredThe identifier of the Db2 database runtime parameter.
The Ansible JCL template
An execution JCL is generated and submitted for this building block. This JCL is generated from the following JCL template:
//********************************************************************
//* BIND - BIND THE DB2 PLAN *
//********************************************************************
//{{item.db2_system.plan_jobcard}}
//JOBLIB DD DISP=SHR,
// DSN={{item.db2_system.sdsnload}}
//PLABIND EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT)
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD DUMMY
//SYSTSIN DD *
DSN SYSTEM ({{item.db2_system.subsys}})
BIND PLAN({{item.db2_system.plan}}) +
PKLIST({{item.db2_system.plan_pklist}}) +
QUALIFIER({{item.db2_system.qualifier}}) +
OWNER({{item.db2_system.sqlid}}) +
ACTION({{item.db2_system.plan_action}}) +
ISOLATION(CS) +
RELEASE(COMMIT) +
ENCODING(EBCDIC)
END
/*
- db2_system
- The Db2 system definition associated to the artifact type.
All the variables that are prefixed by
db2_systemcome from what has been defined for this Db2 system definition in your environment file. For more information, see The Ansible variables.If more than one Db2 system definition exists for the artifact type, one JCL will be created for each Db2 system definition.
- Enter the template name directly as the value of the
template_nameproperty, like in the following example:properties: - key: "template_name" value: "my_template_name.j2" - Enter the name of the variable that contains the template name
as the value of the
var_template_nameproperty, and declare this variable in the environment variables file.In the following example, you entermy_template_variableas the value of thevar_template_nameproperty:properties: - key: "var_template_name" value: "my_template_variable"Then, you declare this variable in the environment variables file. In the example, you entermy_template_name.j2as the value of the my_template_variable variable:my_template_variable: my_template_name.j2
To know how to define the variables in your Jinja2 template, see The variables in the Jinja2 templates.
The Python variables
--envFile argument of The Python deployment command. common_pds_binary_spec:
type: LIBRARY
primary_space: 10CYL
secondary_space: 20CYL
record_format: FB
record_length: 80
hlq: 'NAZARE.WDEPLOY.PYTHON'
default_db2_sdsnload: "DSN.V12R1M0.SDSNLOAD"
default_plan_jobcard: |
BINDPLA JOB 'WD-PLANBIND',MSGLEVEL=(1,1),MSGCLASS=R,NOTIFY=&SYSUID
/* ---
default_db2_user: 'JENKINS'
default_db2_action: "REPLACE"
db2_sys_def:
plan_maxrc: 4
user: "{{ default_db2_user }}"
plan: GENAONE
qualifier: GENADB0
subsys: DBC1
plan_jobcard: "{{default_plan_jobcard}}"
plan_action: "{{default_db2_action}}"
sdsnload: "{{default_db2_sdsnload}}"
plan_pklist: '*.GENASA1.*'
types:
- pattern: .*.DBRM$
dataset: "{{ hlq }}.DBRM"
dataset_backup: "{{ hlq }}.BACK.DBRM"
spec: "{{ common_pds_binary_spec }}"
is_binary: True
db2_systems:
- "{{ db2_sys_def }}"
- 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.
Enter the following variables for each pattern variable:- db2_systems
-
List
RequiredThe list of Db2 system definitions. Each Db2 system definition contains the following variables:
- sdsnload
-
String
RequiredThe name of the
sdsnloadlibrary.
- subsys
-
String
RequiredThe identifier of the Db2 database runtime parameter.
- qualifier
-
String
RequiredThe
Qualifieroption of the bind.
- plan
-
String
RequiredThe name of the bind plan.
- plan_action
-
String
RequiredThe Db2 action.
- plan_jobcard
-
String
RequiredThe parameters of the job card for the JCL that binds the plan.
- plan_maxrc
-
Integer
RequiredThe maximum return code allowed for the successful execution of the job.
- plan_pklist
-
String
RequiredThe list of the packages to be included, with commas as separators.
- user
-
String
RequiredThe
Owneroption of the bind.
- search_paths
-
List
The variable that indicates the list of paths where included Jinja2 templates are stored.
It is used when you provide your own template. For more information, see the note about providing your Jinja2 template in The Python JCL template.
The Python JCL template
An execution JCL is generated and submitted for this building block. This JCL is generated from the following JCL template:
//********************************************************************
//* BIND - BIND THE DB2 PLAN *
//********************************************************************
//{{db2_system['plan_jobcard'].strip()}}
//JOBLIB DD DISP=SHR,
// DSN={{db2_system['sdsnload']}}
//PLABIND EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT)
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD DUMMY
//SYSTSIN DD *
DSN SYSTEM ({{db2_system['subsys']}})
BIND PLAN({{db2_system['plan']}}) +
PKLIST({{db2_system['plan_pklist']}}) +
QUALIFIER({{db2_system['qualifier']}}) +
OWNER({{db2_system['user']}}) +
ACTION({{db2_system['plan_action']}}) +
ISOLATION(CS) +
RELEASE(COMMIT) +
ENCODING(EBCDIC)
END
/*- db2_system
- The Db2 system definition associated to the artifact type.
All the variables that are prefixed by
db2_systemcome from what has been defined for this Db2 system definition in your environment file. For more information, see The Python variables.If more than one Db2 system definition exists for the artifact type, one JCL will be created for each Db2 system definition.
export DEPLOY_TEMPLATES_PATH=MY_TEMPLATE_FOLDER- Enter the template name directly as the value of the
template_nameproperty, like in the following example:properties: - key: "template_name" value: "my_template_name.j2" - Enter the name of the variable that contains the template name
as the value of the
var_template_nameproperty, and declare this variable in the environment variables file.In the following example, you enterThen, you declare this variable in the environment variables file. In the example, you entermy_template_variableas the value of thevar_template_nameproperty:properties: - key: "var_template_name" value: "my_template_variable"my_template_name.j2as the value of the my_template_variable variable:my_template_variable: my_template_name.j2
To know how to define the variables in your Jinja2 template, see The variables in the Jinja2 templates.
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.