6.8.57 DMcob_ValueChange

With this function a value reference managed by IDM may be manipulated. Either the entire value can be replaced or a single element value in a collection.

If the AnyValue parameter is a collection, e.g. of type DT-vector, DT-list, DT-hash, DT-matrix or DT-refvec, an element value can be substituted by specifying the DM-ValueIndex parameter. Similar to predefined attributes, a collection can be extended by incrementing the index with +1. For associative arrays, simply a not yet assigned index key may be used.

If a collection in the DM-Valueparameter is assigned to the target as a whole (i.e. with NULL as DM-ValueIndex parameter), the entire value with all value elements is copied. The conversion of an argument into a locally managed value also requires a complete copying to allow further manipulation.

77 AnyValue pointer value null.

call "DMcob_ValueChange" using
            DM-StdArgs
            AnyValue
            DM-ValueIndex
            DM-Value.

Parameters

<-> DM-options of DM-StdArgs

These are the options available:

Option

Meaning

DMF-AppendValue

For collections, the data value from DM-Value is appended at the end. The index must be NULL for this.

DMF-SortBinary

In collections, the newly set value is finally sorted. May be used in combination with DMF-SortReverse.

DMF-SortLinguistic

In collections, the newly set value is finally sorted, for strings according to linguistic rules (see the built-in function sort()). May be used in combination with DMF-SortReverse.

DMF-SortReverse

In collections, the newly set value is finally sorted in reverse order.

-> AnyValue

Handle of the Managed Value to be changed.

-> DM-ValueIndex

This parameter can be used to change element values in collections and specifies the index. Otherwise, DM-idx-datatype should be set to DT-void. This parameter does not need to be a managed value reference.

-> DM-Value

This parameter defines the value to be set. It may be a managed or an unmanaged value reference.

Return value

DM-status of DM-StdArgs

DM-error

Value could not be set. This may be due to an faulty call, an unmanaged or invalid value reference, or an incorrect indexing.

DM-success

The function has been completed successfully, setting the value succeeded or the value had already been set.

Availability

COBOL Interface for Micro Focus Visual COBOL only.

See also

Function DMcob_ValueChangeBuffer

Chapter “Using the anyvalue Data Type”