Writing output to your file system (DataStage®)
You can direct the XML output to files on your file system. With this option, file paths are written to the output link. The number of files depends partly on the number of output columns that contain XPath expressions and the number of input rows.
You select the root name of the output file, such as acme.xml.
When there is a single output column that has an XPath expression, and you choose the Aggregate All
Rows option, XML Output generates a single file, using the root name.
File paths on the output link
File paths are written on the output link when output is directed to the file system.
Generating output files for multiple columns (DataStage)
When two or more output columns have XPath expressions, XML Output generates a file for each column. You must add a column index flag to the root filename to prevent overwriting. This creates a naming pattern.
Valid flags include:
- %%
Column position, starting with zero (0)- %@
- Column names
You can add these flags before, within, or after the root filename.
Examples
The first output column is CUSTOMERS. The second output column is
DIVISIONS.
- The naming pattern is
acme%%.xml. XML Output generates two files, calledacme0.xmlandacme1.xml. - The naming pattern is
acme%@.xml. XML Output generates two files, calledacmeCUSTOMERS.xmlandacmeDIVISIONS.xml.
Generating output files for rows (DataStage)
When there are two or more output rows, XML Output appends a row index
to the generated filenames. The first index number, zero (0), is omitted from the
file for the first row. The second index number, one (1), is appended as _1.
Use a column index flag when there is more than one output column with an XPath expression and you expect multiple output rows.
For information about setting the output filename, see Options page.
Examples using Single row mode
The
output mode is Single row, which generates one output row per input row. The first output column is
CUSTOMERS. The second output column is DIVISIONS. Both output
columns use XPath expressions.
There are three input rows.
In row 1, the naming pattern is acme%%.xml. XML Output generates
six files:
acme0.xmlacme0_1.xmlacme0_2.xmlacme1_xmlacme1_1.xmlacme1_2.xml
In row 2, the naming pattern is acme%@.xml. XML Output generates
six files:
acmeCUSTOMERS.xmlacmeCUSTOMERS_1.xmlacmeCUSTOMERS_2.xmlacmeDIVISIONS.xmlacmeDIVISIONS_1.xmlacmeDIVISIONS_2.xml
In row 3, the root filename acme.xml is used. Because
a column index flag is omitted, XML Output generates and overwrites three files. The final files
contain XML chunks for the second column (DIVISIONS).
acme.xmlacme_1.xmlacme_2.xml
To avoid this result, use column index flags when there are multiple columns and rows.
Example using passthrough columns
The output mode is
Aggregate all rows, which generates one output row unless there is a passthrough
column. ZONE is the passthrough column, and the output column
CUSTOMER uses the forward slash (/) as the Description property. Here are the input
rows.
| CUSTOMER | DIVISION | CITY | ZONE |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The root filename acme.xml is used because only one output column
is involved in the transformation. XML Output generates two output files, acme.xml
and acme_1.xml, because the ZONE value changes in the fourth input
row. The ZONE values are written on the output link but not to the output
files.