Copy Stage Example

It is a one of a Processing stage and as the name suggests helps in creating a copy.It can have one input link and n number of output links which helps to create multiple copies of input data.

Copy Stage also helps to make a backup for data while performing another operation on that data. In addition to create multiple copies of data we can also drop or change order of columns, modify data type of columns.

In Copy Stage, we have the option called Force. It will be false in Default and if we keep it to true, it is used to specify that datastage should not try optimize the job by removing a copy operation where there is one input and only one output.

Example:

In below example we are having Employee details in a sequential file as an input and needs to be copied to a Dataset.

Input Data:

copy input - Copy Stage Example

Follow below steps:

Design you job same as shown below:

Copy Example1 - Copy Stage Example

Open the Properties tab of Sequential file. Select Sequential File stageàRight Clickàselect Properties and load the Table Definition.

Open the Properties tab of Copy Stage, Under Properties Tab, and Set Force compile option to ‘True’ if input data is copied to only one output/target. Otherwise set this option to ‘False’.

Copy Example10 - Copy Stage Example

Under mapping tab, select the columns from Left i.e. from Source/Input and drag and drop to Right i.e. Target/Output as shown below.

Copy Example11 - Copy Stage Example

The Output columns will appear similar to shown below:

Copy Example12 - Copy Stage Example
Provide the target file path and name in the InputàProperties tab in Dataset stage as below.
Copy Example13 - Copy Stage Example
After successful job run, View the data from the target Dataset to validate.

Output Data:

copy output - Copy Stage Example