Topics: |

As an alphanumeric type, an
A*n*V field can be used in arithmetic and logical expressions
in the same way that the A*n* type is used.

- An expression
that contains A
*n*V type fields can be of either the A*n*V or A*n*type. - The type that results from the expression depends on the specific type of operation, as described in subsequent sections.

Note: Because A*n*V fields have two bytes of overhead
and there is additional processing required to strip them, A*n*V
format is not recommended for use in non-relational data sources.

If either of the operands in
a concatenation between two fields is an A*n*V field, variable
length alphanumeric rules are used to perform the concatenation:

- The size of the concatenated string is the sum of the sizes of the operands.
- For weak concatenation, the actual length of the concatenated string is the sum of the two actual lengths of the input strings.
- For strong concatenation, the actual
length stored in an A
*n*V field of the concatenated string is the sum of the actual length of the first input string minus its number of trailing blanks plus the actual length of the second string. - For any A
*n*field in the concatenation, the size and length are equal. - Two consecutive single quotation marks represent a null value with format A1V and an actual length of 0 (zero), when the field has MISSING ON.

The following expression results
in an A*n*V format only when *x* has A*n*V format.

EDIT(x,mask)

The actual length of the result is the number of characters in *mask* other
than '$'.

Note that an actual length of zero may result.

EDIT(*x*) can be used to convert an A*n*V field to
an integer value when x has A*n*V format.

The only difference in evaluation of the CONTAINS and
OMITS operators with A*n*V fields occurs when one of the operands
has an actual length of zero.

In the following examples, the field Z has an actual length of zero, but X and Y do not:

Expression |
Result |
---|---|

Z CONTAINS Y |
FALSE |

X CONTAINS Z |
TRUE |

Z CONTAINS Z |
TRUE |

Z OMITS Y |
TRUE |

X OMITS Z |
FALSE |

Z OMITS Z |
FALSE |

The only difference in evaluation
of the following expression occurs when *x* has an actual length
of zero:

x LIKE mask ...

In the following example, the field instance Z has an actual length of zero:

Z LIKE mask ...

This expression evaluates to TRUE only when the mask consists exclusively of percent ('%') signs.

Note that no other mask can evaluate to an empty string. Even the mask in the following expression has a length of one, and therefore the expression evaluates as FALSE:

Z LIKE ''

As with A*n* type fields, operations are evaluated
on the assumption that the shorter operand is padded with blanks.

Therefore, even an empty A*n*V field, Z, is compared as
a field consisting of all blanks.

In the following examples, Z is an empty
A*n*V field instance and X is an A*n*V field instance
that is not empty and contains non-blank characters:

Expression |
Result |
---|---|

Z EQ Z Z GE Z Z LE Z |
TRUE |

Z NE Z Z LT Z Z GT Z |
FALSE |

Z EQ X |
FALSE |

Z NE X |
TRUE |

Z LT X |
TRUE |

Z GT X |
FALSE |

Z LE X |
TRUE |

Z GE X |
FALSE |

X EQ Z |
FALSE |

X NE Z |
TRUE |

X LT Z |
FALSE |

X GT Z |
TRUE |

X LE Z |
FALSE |

X GE Z |
TRUE |

DECODEalphafield(value'result'...

The use of either an A*n* or A*n*V field with DECODE
causes a result of type A*n* as long as the *result* part
of the value-result pairs is provided as a constant. (Constants
are type A*n*.)

There are three situations to
consider when using the assignment operator with the A*n*V
format: A*n*V data type on the right hand side only, AnV data type
on both sides, and A*n*V data type on the left side only.

fld/An= AnV_type_expression;

- The actual
length of the evaluated expression is lost on assignment to the A
*n*field. - The size of
the A
*n*V result does not prevent assignment to a shorter A*n*format field:- If the result of the expression has an actual length that is shorter than the length of the field on the left side of the assignment operator, the result is padded with blanks.
- If the result
of the expression has an actual length that is longer than the length
of the field on the left side of the assignment operator, the result
is truncated.
`fld`/A`n`V = A`n`V_`type`_`expression`;

- The length
of the result is assigned as the length of the field on the left
of the assignment operator unless it exceeds the field's declared
size. In this case, the length assigned is the declared size (
*n*). - The size of the A
*n*V evaluation result does not prevent assignment to a shorter A*n*V field:- If the length of the result of the expression is shorter than the size of the field on the left side of the assignment operator, the result is padded with blanks.
- If the result of the expression has
an actual length that is longer than the size of the field on the
left side of the assignment operator, the result is truncated.
`fld`/A`n`V = A`n`_`type`_`expression`;

- The length of the field on the left
side of the assignment operator is assigned equal to its size (
*n*). - The actual
length of the result is verified against the size
*n*declared for the AnV field. An error is generated if the result is longer than*n*.

WebFOCUS | |

Feedback |