LOCVAL
LOCVAL(x, a) returns the value at the offset that is specified by x in the a area. The type of the value is specified in the LOCATES attribute of x.
- x
- Must be an OFFSET with the LOCATES attribute. It must be a valid, non-null offset into the area a.
- a
- Must be an AREA reference. If you do not specify a, the OFFSET attribute for x must have specified an AREA reference, and the offset is assumed to be from that area.
Do not use a LOCVAL reference as the argument to the ADDR built-in function. To obtain the address of such a reference, apply the POINTER built-in function to the corresponding OFFSET.
Example
With the following declaration,
these two references are equivalent:
locval(name(1));
and locval(name(1),
pool);
. Both references return the char(30)
varying
value at the location in pool
with the offset held
in name(1)
. declare
1 data based(data_ptr) unaligned,
2 actual_count fixed bin(31),
2 orderinfo(order_count refer( actual_count)),
3 name offset(pool) locates(char(30) varying),
3 address offset(pool) locates(char(62) varying),
2 pool area(10_000);