Ab Initio - V1.3
Ab Initio - V1.3
Ab Initio - V1.3
– Base Types
The base types are atomic types which can used to
store data.
- Compound Types
The compound types are made up of atomic types
or Base types.
Hierarchy of types
Void Types
• Example: void(10)
Integer Types
• Interprets the data as an integer
• Example: integer(10)
Decimal Types
• SYNTAX
[character set|packed] [decimal(size)|
decimal(size,zoned) |
decimal(size,position) |
decimal(size,position,zoned)]
• Examples:
decimal(8)
decimal(‘,’)
packed decimal(2)
decimal(3,0,zoned)
• Punctuation marks are not considered
String Types
• Syntax: [character set] string(length)
• Fixed String Examples
– String(20) var_name;
• Delimited Strings
• Examples
date(“YYYYMMDD”); - 19060902
date(YYYY/MM/DD); - 1998/02/01
date(YYMMDD,split = “500101”);
• Examples:
ebcdic string(“YYYY-MMM-
DD:hh:mi:ss”)(“,”) timestamp;
• Examples
– Unsigned integer(4) [7][3]
Record Types
• Record type is a compound type
• Simple record types
record
field_type field1;
field_type field2;
end
– Example
Record
string(“,”) first_name,last_name;
decimal(3) age;
End(“\n”)
Record Types
Record
string(6) item_name;
decimal(7,2) price;
decimal(3,0) quantity;
decimal(7,2) total() = price* quantity;
end
Field-validity
checking functions
• This is used to check the validity of the variables
present in the record
• Rules:
– Must begin with a is_valid;
– Must not have any arguments
– This must have a return type which is int
– Must be defined within the record .. End pair
• Example
Record
string(3) a;
int is_valid_a() = ! Is_blank(a);
End
Record types .. ..
• Conditional fields
– Example
Record
decimal(1) type_of_rec;
if (type_of_rec == 1)
string(10) name;
else
string(20) item_name;
end
Unions
• Example
type address_type =
record
string(10) street1,street2;
string(12) city;
string(9) state;
end;
Key Specifiers
What are Key Specifiers
• Key specifiers are used to order, partion or group
records
• Example
{age;firstname}
• Examples:
{ last_name; first_name;age descending}
Sequence Specifiers
• Specifies the priority
• Constants
– Integer Constants
• 1,+12,-123,0x012,0o12,0b1101101
– Real Constants
• +12,-45.6,2E6
– Decimal Constants
• 12.3d
• +0.01D
• 11d
– String Constants
• “Characters”
• “Hi Hutch”
• “(‘)This is abInitio(‘)”
Simple Expressions ….
• Variable References
– Normal variables
– Follows the C rules of naming the variables
– The ‘let’ statement
– Local and Global Variables
• NULL expressions
• Environment Variables
– Preceded with a $ sign
– Used to pass application wide parameters to the graphs
– Evaluated at the start time of the graph
• This_record expression
– Refers to the whole record
Extraction Expressions
• Element Expressions
dependents[I+3]
dependents[(I*12)+1)
• Field Expression
record_type.field_name;
Operator Expressions
• Unary Expressions
+, - , ! , ~
• Binary Operators
+,-,*, / , % Arithmetic operators
==, !=, <, >, <=, >= Comparison Operators
||, && Logical Operators
|,^,& Bit Wise operators
<<,>> Shift operators
• Ternary Operators
Test expression ? Exp1: Exp 2 If statement
Type Casting Expressions
• Type casting
– Implicit Type casting
- Restrictions
- Examples
- REINTERPRET_AS
Conditional Expressions
• If- Else Statements
– If (expression)
statements
• For statement
– For (I , I<N)
statements
• While Statements
- while (conditional_expression)
statements;
Transformation Functions
• Used to code the business logic in the system
• FLOOR
• MATH_ABS
• DECIMAL_ROUND
• REINTERPRET_AS
• STRING_CHAR
• STRING_REPLACE
• STRING_SUBSTRING