Examples (DataStage)
Last updated: Mar 12, 2025
This section gives examples of input and output data from a Column Import stage.
In this example the Column Import stage extracts data from 16-byte raw data field
into four integer output fields. The input data set also contains a column which is passed straight
through the stage. The example assumes that the job is running sequentially. The metadata is as
follows:
Column name | Key | SQL type |
---|---|---|
keycol | Yes | Char |
col_to_import | Binary |
These are the rows from the input data set:
- Keycol
- col_to_import
- a
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- b
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- c
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- d
- 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
- e
- 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
- f
- 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
- g
- 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
- h
- 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07
- i
- 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08
- j
- 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09
The import table definition can either be supplied on the
Output Page Columns tab or in a schema file. For the
example, the definition would be:
Column name | Key | SQL type |
---|---|---|
keycol | Yes | Char |
col1 | Integer | |
col2 | Integer | |
col3 | Integer | |
col4 | Integer |
You have to give IBM® DataStage® information about how to treat the imported data to split it into the required columns. This is done on the Output tab in the Format section. For this example, you specify a data format of binary to ensure that the contents of col_to_import are interpreted as binary integers, and that the data has a field delimiter of none
The properties of the Column Import stage are set as follows:
- On the Properties tab in the Column to import section, specify col4.
The output data set will be:
col1 | col2 | col3 | col4 | key |
---|---|---|---|---|
0 | 0 | 0 | 0 | a |
16843009 | 16843009 | 16843009 | 16843009 | b |
33686018 | 33686018 | 33686018 | 33686018 | c |
50529027 | 50529027 | 50529027 | 50529027 | d |
67372036 | 67372036 | 67372036 | 67372036 | e |
84215045 | 84215045 | 84215045 | 84215045 | f |
101058054 | 101058054 | 101058054 | 101058054 | g |
117901063 | 117901063 | 117901063 | 117901063 | h |
134744072 | 134744072 | 134744072 | 134744072 | i |
151587081 | 151587081 | 151587081 | 151587081 | j |
Was the topic helpful?
0/1000