Examples (DataStage®)

This section gives examples of input and output data from a Make Subrecord stage.

In this example, the Make Subrecord stage extracts data from four input columns, three of which carry vectors. The data is output in two columns, one carrying the vectors in a subrecord, and the nonvector column that is passed through the stage. The example assumes that the job is running sequentially. The following table shows column definitions for the input data set:
Table 1. Column definitions
Column name SQL type
key Char
acol Integer
bcol Char
ccol Char
.
The following table shows the rows from the input data set (superscripts represents the vector index):
Table 2. Input data set
  Key acol bcol ccol
row A 12013142643 Wills0wombat1bill2william D00 1
row B 2206142213 Robin0Dally1Rob2RD3 G0A1
row C 7600152223 Beth0Betany1Bethany2Bets3 B071
row D 406181203 Heathcliff0HC1Hchop2Horror3 A011
row E 20416283 Chaz0Swot1Chazlet2Twerp3 C0H1
row F 180815283 kayser0Cuddles1KB2Ibn Kayeed3 M011
row G 1201016213 Jayne0Jane1J2JD3 F021
row H 1200162433 Ann0Anne1AK2AJK3 H0E1
row I 300172823 Kath0Cath1Catherine2Katy3 0H1
row J 500172023 upert0Rupe1Woopert2puss3 B0C1
The stage outputs the subrecord that it builds from the input data in a single column called parent. The column that is called key will be output separately. The output column definitions are as follows:
Table 3. Output column definitions
Column name SQL type
key Char
parent Char

The output data set will be:

Table 4. Output data set
  Key Parent
    0 1 2 3
row A 12 13 4 64
    Will wombat bill William
    D 0 pad pad
  B 22 6 4 21
    Robin Dally Rob RD
    G A pad pad
  C 76 0 52 2
    Beth Betany Bethany Bets
    B 7 pad pad
  D 4 6 81 0
    Heathcliff HC Hchop Horror
    A 1 pad pad
  E 2 4 6 8
    Chaz Swot Chazlet Twerp
    C H pad pad
  F 18 8 5 8
    Kayser Cuddles KB Ibn Kayeed
    M 1 pad pad
  G 12 10 6 43
    Jayne Jane J JD
    F 2 pad pad
  H 12 0 6 43
    Ann Anne AK AJK
    H E pad pad
  I 3 0 7 82
    Kath Cath Catherine Katy
    C H pad pad
  J 5 0 7 02
    Rupert Rupe Woopert puss
    B C pad pad