type: copy

This step copies files and dataset members between HFS and datasets.

Before you define this step, make sure that the common elements of the steps are defined. See steps.

The copy step supports different source and target types and can map to the DBB CopyToPDS and CopyToHFS commands or even the z/OS UNIX cp command depending on source and target type combinations. It also optionally supports copying source file dependencies from z/OS UNIX to PDS through the dependencyCopy block.

The source and target types determine what operation is executed to perform the copy. z/OS UNIX files can be defined with relative (to the $WORKSPACE) or absolute file paths. Data sets use the // prefix convention to indicate they are data sets.

The following table maps the possible combinations of source and target types to the copy command that is run.

Source Target Command
z/OS UNIX file z/OS UNIX file UNIX cp command
z/OS UNIX file Data set CopyToPDS
Data set z/OS UNIX file CopyToHFS
Data set Data set UNIX cp command

Syntax

- step: string # name of step
  type: copy # The Copy step type
  source: string # source file or dataset member that contains the JCL to submit.
  target: string # JCL source contained in a string. 
  options: string | [ string ] # For hfs -> hfs and dataset -> dataset 'cp' options
  append: boolean # Flag indicating to append or overwrite an existing file.
  volser: string # the volume serial of the source dataset.
  sourceEncoding: string # source codepage 
  targetEncoding: string # target codepage
  copyMode: string # The DBB copy mode 
  deployType: string # The deploy type for this copy record
  dependencyCopy: # copies build dependencies for this source file
    - search: string # the search path configuration string
      mappings: # CopyToPDS mappings
        - source: string # source glob pattern
          dataset: string # target dataset
          copyMode: string # The DBB copy mode
          volser: string # the volume serial of the target dataset

Syntax description

source

The source of the copy. This field can represent a UNIX file or a dataset.

Note: Z/OS UNIX System Services files can be defined relative to the workspace or absolute. Datasets use the // prefix convention to indicate they are datasets. Example: '//${HLQ}.JCL(HELLO)'

target

The target of the copy. This field can represent a UNIX file or a dataset.

Note: Z/OS UNIX System Services files can be defined relative to the workspace or absolute. Datasets use the // prefix convention to indicate they are datasets. Example: '//${HLQ}.JCL(HELLO)'

options

Options for HFS -> HFS and dataset -> dataset cp options.

append

A boolean flag that indicates whether the target file should be overwritten or appended.

volser

The volume serial of the source dataset.

sourceEncoding

The codepage of the source file or dataset.

targetEncoding

The codepage of the target file or dataset.

copyMode

The DBB copy mode that should be used when copying files as defined in DBBConstants.CopyMode. Possible options are TEXT, BINARY, LOAD, or ASA_TEXT. For more information on DBB copy modes, refer to the CopyToHFS and CopyToPDS documentation.

deployType

Version Requirement: This field was added in build configuration schema version 1.0.1 introduced in DBB 3.0.1.

The copy step deploy type for build report output population.

dependencyCopy

Optional element to identify and copy build dependencies of source files to mapped datasets. It can contain one or more dependency search paths. Each search path can have one or more single search field to define the search path used to invoke the SearchPathDependencyResolver for dependency resolution on the logical dependencies of the build file.

Example

- step: CopySource
  type: copy
  source: ${WORKSPACE}/${APPLICATION}/${FILE}
  target: //${HLQ}.COBOL(${MEMBER})
  dependencyCopy:
    - search: 'search:${WORKSPACE}/${APPLICATION}/?path=**.cpy'
      mappings:
        - source: ‘**/*.cpy’
          dataset: ${HLQ}.COPY

An example of copying the build file source (from ${WORKSPACE}/${APPLICATION}/${FILE} -> //${HLQ}.COBOL(${MEMBER})) and utilizing DBB dependency resolution to resolve and copy dependencies from Z/OS UNIX System Services to //${HLQ}.COPY(${MEMBER}).