CURRENTSIZE returns a FIXED BIN value that gives the implementation-defined
storage, in bytes, required by x.
>>-CURRENTSIZE(x)----------------------------------------------><
- x
- A variable of any data type, data organization, and storage class
except those in the following list:
- A BASED, DEFINED, parameter, subscripted, or structure or union
base-element variable that is an unaligned fixed-length bit string
- A minor structure or union whose first or last base element is
an unaligned fixed-length bit string (except where it is also the
first or last element of the containing major structure or union)
- A major structure or union that has the BASED, DEFINED, or parameter
attribute, and that has an unaligned fixed-length bit string as its
first or last element
- A variable not in connected storage
The value returned by CURRENTSIZE(x) is defined as the number of
bytes that would be transmitted in the following circumstances:
declare F file record output
environment(scalarvarying);
write file(F) from(S);
If x is a scalar varying-length string,
the returned value includes the length-prefix of the string and the
number of currently-used bytes. It does not include any unused bytes
in the string.
If x is a scalar area, the returned value
includes the area control bytes and the current extent of the area.
It does not include any unused bytes at the end of the area.
If
x is an aggregate containing areas
or varying-length strings, the returned value includes the area control
bytes, the maximum sizes of the areas, the length prefixes of the
strings, and the number of bytes in the maximum lengths of the strings.
There is an exception to this rule:
- If x is a structure or union whose
last element is a nondimensioned area, the returned value includes
that area's control bytes and the current extent of that area. It
does not include any unused bytes at the end of that area.
The CURRENTSIZE built-in function must not be used on a BASED variable
with adjustable extents if that variable has not been allocated.
Under the CMPAT(V3) compiler option, CURRENTSIZE returns a FIXED
BIN(63) value. Under all other CMPAT options, it returns a FIXED BIN(31)
value.
For examples of the CURRENTSIZE built-in function, see SIZE.