sequential_copy
This building block copies artifacts to a z/OS® sequential data set. It creates the data set if it does not exist.
It is run on the artifacts that are listed under the step that it implements in The deployment plan.
actions:
- name: COPY ARTIFACTS TO A ZOS DATA SET
short_name: COPY_TO_ZOS
steps:
- name: TEST STEP FOR SEQUENTIAL_COPY
short_name: TEST_SEQ_COPY
properties:
- key: template
value: sequential_copy
types:
- name: 'seq'
- name: 'seqa'
is_artifact: True
This building block is related to the following artifact type: sequential data set. 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
seq_spec:
type: SEQ
space_primary: 5
space_secondary: 2
space_type: TRK
record_format: FB
record_length: 20
seq_spec_a:
type: SEQ
space_primary: 2
space_secondary: 1
space_type: TRK
record_format: FB
record_length: 15
hlq: 'NAZARE.WDEPLOY.ANSIBLE'
default_types: 'types'
types:
- type: 'seq'
is_binary: False
is_sequential: True
encoding:
from: UTF-8
to: IBM-037
# is_asa_text: False
ds:
prefix: "{{ hlq }}.SEQ"
backup_prefix: "{{ hlq }}.BACK.SEQ"
spec: "{{seq_spec}}"
- type: 'seqa'
is_binary: False
is_sequential: True
encoding:
from: UTF-8
to: IBM-037
# is_asa_text: False
ds:
prefix: "{{ hlq }}.SEQ"
backup_prefix: "{{ hlq }}.BACK.SEQ"
spec: "{{seq_spec_a}}"
- The common variables that define the characteristics of the
sequential data sets associated with an artifact type or a group of artifact types. These variables
prevent the repetition of the same values in the continuation of the variables file.
In this sample code, two roots for the common variables are defined but you must adapt the number of roots to your needs. The names of the roots (
seq_spec
andseq_spec_a
in the sample code) can be freely chosen. However, you must specify the names of all their embedded variables as they are in the sample code.The value of the embedded type variable must be set to
SEQ
. Adapt the values of the other embedded variables to your needs. - 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:- Two variables that specify the nature of the artifacts:
is_sequential and is_binary. Set
is_sequential to
True
if the files are sequential. Set is_binary toTrue
if the files are binary. - An encoding variable if an encoding is
needed. To indicate an encoding, you must specify the following variables: from
for the initial encoding and to for the target encoding.
This variable is incompatible with the is_asa_text variable.
- An is_asa_text variable for the artifacts that contain ASA control
characters.
If this variable is set to
True
, the copy will preserve ASA control characters in the destination. The default value isFalse
.This variable is incompatible with the encoding variable.
The force_lock variable is ineffective with is_asa_text.
-
A ds variable with the following embedded variables:
- A prefix variable for the data set prefix.
- A spec variable to use the values of the common variables for the data set characteristics.
- A
text_subs if you want to use text substitution for artifacts that are not binary
files (
is_binary: False
). You can substitute a pattern, which is a regular expression, by a replacement text before the copy.For example, you can enter the following code:- type: 'seq' ds: prefix: "{{ hlq }}.SEQ" backup_prefix: "{{ hlq }}.BACK.SEQ" spec: "{{seq_spec}}" encoding: from: UTF-8 to: IBM-1047 text_subs: - pattern: "#SUB1" replace: "01" - pattern: "#SUB2" replace: "02" - pattern: "#SUB3" replace: "03"
- 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
andreplace
are regular expressions.- type: 'seq' ds: prefix: "{{ hlq }}.SEQ" backup_prefix: "{{ hlq }}.BACK.SEQ" spec: "{{seq_spec}}" encoding: from: UTF-8 to: IBM-1047 rename_subs: - pattern: "CDRD(.*)" replace: "CDRP\1"
- Two variables that specify the nature of the artifacts:
is_sequential and is_binary. Set
is_sequential to
The Python variables
--envFile
argument of The Python deployment command. seq_spec:
type: SEQ
primary_space: 5TRK
secondary_space: 2TRK
record_format: FB
record_length: 20
seq_spec_a:
type: SEQ
primary_space: 2TRK
secondary_space: 1TRK
record_format: FB
record_length: 15
hlq: 'NAZARE.WDEPLOY.PYTHON'
types:
- pattern: .*.SEQ$
dataset_prefix: "{{ hlq }}.SEQ"
dataset_backup_prefix: "{{ hlq }}.BACK.SEQ"
encoding:
from: UTF-8
to: IBM-037
# is_asa_text: False
is_binary: False
is_sequential: True
spec: "{{seq_spec}}"
- pattern: .*.SEQA$
dataset_prefix: "{{ hlq }}.SEQ"
dataset_backup_prefix: "{{ hlq }}.BACK.SEQ"
encoding:
from: UTF-8
to: IBM-037
# is_asa_text: False
is_binary: False
is_sequential: True
spec: "{{seq_spec_a}}"
- The common variables that define the characteristics of the
sequential data sets associated with an artifact type or a group of artifact types. These variables
prevent the repetition of the same values in the continuation of the variables file.
In this sample code, two roots for the common variables are defined but you must adapt the number of roots to your needs. The names of the roots (
seq_spec
andseq_spec_a
in the sample code) can be freely chosen. However, you must specify the names of all their embedded variables as they are in the sample code. - 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:- A dataset_prefix variable for the prefix of the z/OS sequential data set.
- A spec variable to use the values of the common variables for the data set characteristics.
- An encoding variable if an encoding is
needed. To indicate an encoding, you must specify the following variables: from
for the initial encoding and to for the target encoding.
This variable is incompatible with the is_asa_text variable.
- An is_asa_text variable for the artifacts that contain ASA control
characters.
If this variable is set to
True
, the copy will preserve ASA control characters in the destination. The default value isFalse
.This variable is incompatible with the encoding variable.
The force_lock variable is ineffective with is_asa_text.
- Two variables that specify the nature of the artifacts:
is_sequential and is_binary. Set
is_sequential to
True
if the files are sequential. Set is_binary toTrue
if the files are binary. - A
text_subs if you want to use text substitution for artifacts that are not binary
files (
is_binary: False
). You can substitute a pattern, which is a regular expression, by a replacement text before the copy.For example, you can enter the following code:- pattern: .*.SEQ$ dataset_prefix: "{{ hlq }}.SEQ" dataset_backup_prefix: "{{ hlq }}.BACK.SEQ" encoding: from: UTF-8 to: IBM-037 spec: "{{seq_spec}}" text_subs: - pattern: "#SUB1" replace: "01" - pattern: "#SUB2" replace: "02" - pattern: "#SUB3" replace: "03"
- 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
andreplace
are regular expressions.- pattern: .*.SEQ$ dataset_prefix: "{{ hlq }}.SEQ" dataset_backup_prefix: "{{ hlq }}.BACK.SEQ" encoding: from: UTF-8 to: IBM-037 spec: "{{seq_spec}}" 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.