pTAL Conversion Guide

Expressions
pTAL Conversion Guide527302-002
13-9
Using FIXED(*) Variables
Using FIXED(*) Variables
You declare FIXED(*) variables as you do other FIXED variables; however, pTAL does
not scale data items that it stores into FIXED(*) items.
The procedure p has one local variable whose data type is FIXED(*):
PROC p;
BEGIN
FIXED(*) f;
f := 1234F;
END;
The data type of a FIXED(*) variable is the same as a FIXED variable:
FIXED(*) f1 := 123F;
FIXED(2) f2;
f2 := f1; ! f2 is assigned 123.00
pTAL does not scale data when it stores into a FIXED(*) variable:
FIXED(2) f1 := 1.23F;
FIXED(*) f2;
FIXED f3;
f2 := f1; ! f2 is assigned 123
f3 := f1; ! f3 is assigned 1
t := i7 [1]; ! OK: i7 is referenced in an equivalence
! declaration
t := i8 [1]; ! OK: i8 is an equivalenced variable
t := j [1]; ! ERROR: cannot index a value parameter
t := k [1]; ! OK: k is a reference parameter
t := m [1]; ! OK: m is referenced in an equivalenced
! declaration
t := s1.a[1]; ! OK: You can index any field in a structure
t := s1.b[1]; ! OK: You can index any field in a structure
END;
Example 13-7. FIXED(*) Variables
FIXED(*) f1;
FIXED(3) f2 := 1.234F;
f1 := f2; ! f1 = 1234
f2 := f1; ! f2 = 1234.000
f1 := f2; ! f1 = 1234000
f2 := f1; ! f2 = 1234000.000
f1 := f2; ! f1 = 1234000000
f2 := f1; ! f2 = 1234000000.000
Example 13-6. Indexing in TAL and pTAL (page2of2)