Professional Documents
Culture Documents
P2 Ab Initio Basic Components Contd
P2 Ab Initio Basic Components Contd
Components Contd…
> Joining Data
0345Smith
0345Smith Bristol
Bristol 56
56 0322970402
0322970402 1242.50
1242.50
0212Spade
0212Spade London
London 88 0345970924
0345970924 923.75
923.75
0322Jones
0322Jones Compton
Compton 12
12 0121961211
0121961211 12392.00
12392.00
0492West
0492West London
London 23
23 0492971123
0492971123 234.12
234.12
0121Forth
0121Forth Bristol
Bristol 77 0666950616
0666950616 2312.10
2312.10
0221Black
0221Black New
New York
York 42
42
0345Bristol
0345Bristol 561997/09/24
561997/09/24
0212London
0212London 81900/01/01
81900/01/01
0322Compton
0322Compton 121997/04/02
121997/04/02
0492London
0492London 231997/11/23
231997/11/23
0121Bristol
0121Bristol 71996/12/11
71996/12/11
0221New
0221New York
York 421900/01/01
421900/01/01
0121Forth
0121Forth Bristol
Bristol 77 0121961211
0121961211 12392.00
12392.00
0212Spade
0212Spade London
London 88
0221Black
0221Black New
New York
York 42
42
0322Jones
0322Jones Compton
Compton 12
12 0322970402
0322970402 1242.50
1242.50
0345Smith
0345Smith Bristol
Bristol 56
56 0345970924
0345970924 923.75
923.75
0492West
0492West London
London 23
23 0492971123
0492971123 234.12
234.12
0666950616
0666950616 2312.10
2312.10
0121Bristol
0121Bristol 71996/12/11
71996/12/11
0212London
0212London 81900/01/01
81900/01/01
...
...
Join performs a join of inputs. By default, the inputs to join must be sorted
and an inner join is computed.
Types Of Join
Inner Join (Default)
Full outer Join
Explicit Join
in0: in1:
record record
decimal(4) id; decimal(4) id;
string(6) name; date(”YYMMDD”) dt;
string(8) city; decimal(9.2) cost;
decimal(3) amount; end
end
out:
record
decimal(4) id;
string(8) city;
decimal(3) amount;
date(“YYYY/MM/DD”)dt;
end
in0: in1:
record record
decimal(4) id; decimal(4) id;
string(6) name; date(”YYMMDD”) dt; ???
string(8) city; decimal(9.2) cost;
decimal(3) amount; end
end
out:
record
decimal(4) id;
string(8) city;
decimal(3) amount;
date(“YYYY/MM/DD”)dt;
end
If an assignment for a left hand side fails, the next priority assignment is
tried. There must be one successful assignment for each output field.
a b c a q r
a b c a q r
a x q
Align inputs by a
Align inputs by a
Align inputs by a
G 234 42 G NY 4
Align inputs by a
G 234 42 G NY 4
Align inputs by a
G 238 NY
Using Last-Visits
as a lookup file
Transform function:
out :: lookup_info(in) =
begin
out.id : : in.id;
out.city : : in.city;
out.amount : : in.amount;
out.dt :1 : lookup(”Last-Visits”, in.id).dt;
out.dt :2 : ”1900/01/01”;
end;
Input Output
Note that if the Watcher files do not exist, the GDE will build them during the
first run only, using the Watchers on successive runs