6.8.58 DMcob_ValueChangeBuffer

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. Unlike DMcob_ValueChange, this function provides a buffer for string return values that is larger than the standard buffer.

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.
77 StringBuffer pic X(100) value  spaces.
77 StringLength pic 9(9)   binary value 100.

call "DMcob_ValueChangeBuffer" using
            DM-StdArgs
            AnyValue
            DM-ValueIndex
            DM-Value
            StringBuffer
            StringLength.

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.

<- StringBuffer

Buffer for the string, to modify strings longer than 80 characters.

-> StringLength

Length of the buffer (100 here), must match the definition.

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_ValueChange

Chapter “Using the anyvalue Data Type”