Information Technology Reference
In-Depth Information
since the field
y
only has room for 4 characters, it can only accept that many and so truncation will occur.
Note that in any assign statement, the variable on the right side of the equal sign will be
unchanged. If the first assign is done followed by
x = y
the result will be that
x
will have the value
Hand ,
that is the rightmost two characters will be spaces and
y
will be
Hand ,
since that value won't change from the first assignment.
Now let us consider
define a decimal (6.2) value 82344.57
define b decimal (4.1)
Once the following statement is executed
b = a ,
a
will be unchanged but
b
will have the value 2344.5 . Thus truncation will occur on both the left since the variable
b
only allows for 4 digits to the left of the decimal point as well as on the right since there
is only room for a single digit to the right of the decimal point. Note that the number that
results in
b
is not rounded. You may never run into this situation exactly but may need something
similar in order to truncate a value.
We have seen the following before but since we will be using it over and over, it
is worth repeating.
define line-counter integer( 2) value 0
loop: line-counter = line-counter + 1
if line-counter > 9
go to end-program
end-if
go to loop
end-program: end
Search WWH ::




Custom Search