P4 Ab Initio - Lookup File and Reusability Features
P4 Ab Initio - Lookup File and Reusability Features
Gokulnath J
Objectives
Lookup Files
Other lookup functions
Using lookup_local()
Other local lookup functions
Lookup Modifiers
Conditional Components
Sub graphs
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;
Performance considerations:
You can use lookup_match to quickly determine whether or not a particular key value is
contained in a lookup file. This function is faster than lookup and lookup_count, and is useful
when you do not care about the matched record or how many matching records there are.
In these circumstances, instead of using the following code construct:
if (is_defined(lookup(file, key)))
statement1
else
statement2
if (lookup_match(file, key))
statement1
else
statement2
Usage:
record lookup_local (string file, expression [,
expression ...] )
Multifile
Multifilepartitioned
partitionedby
byfield
fieldAA
Input
Inputdata
datapartitioned
partitionedby
byfield
fieldAA
lookup_local(“Lookup
lookup_local(“LookupFile”,
File”,in.A)
in.A)
{west_longitude interval}
If the Lookup File contains four records with the values 75,
90, 105, and 180 in the west_longitude field, then the
intervals corresponding to the first three records are 75..89,
90..104, and 105..179:
Conditional Components
Subgraphs
Linked Subgraphs
Component 1 condition:
$( if [[ $DO_SORT = "1" ]]; then print 0; else print 1; fi )
Component 2 condition:
$( if [[ $DO_SORT = "1" ]]; then print 1; else print 0; fi )
Save subgraph:
– File -> Save Subgraph “name” As …
– This must be saved to shared directory
– Usually best to copy *.mp file for subgraph to a directory on the
server, for shared access