6.8.59 DMcob_ValueCount
Returns the number of values in a collection (without the default values). It is also possible to return the index type or the highest index value.
The returned value indicates the number of values (without the default values). Thus, in combination with the DMcob_ValueIndex function, loops over all indexed values respectively elements can be implemented easily.
77 AnyValue pointer value null. 77 Count pic 9(9) binary value 0. call "DMcob_ValueCount" using DM-StdArgs AnyValue DM-Value Count.
Parameters
<-> DM-options of DM-StdArgs
These are the options available:
Option |
Meaning |
---|---|
This option means that text values (IDs of type DT-text) should be returned as strings in the currently set language. |
|
This option means that text values (IDs of type DT-text) should be returned as a strings in the development language, regardless of which language the user is currently working with. |
|
Strings are usually passed to the application in a temporary buffer, which is retained until the next call to the IDM. If strings in the application shall be valid longer, the option DMF-DontFreeLastStrings has to be set. Then the memory will not be released until an IDM function returning a string from the IDM to the applicationis called without this option. |
-> AnyValue
Handle of the Managed Value from which the number of values is fetched. It should be a managed value reference or function argument.
<- DM-Value
Here the count value is returned. This may be a managed value reference, however this is not mandatory.
Depending on the AnyValue parameter, the following results may occur:
AnyValue
|
Count |
|
---|---|---|
DT-refvec, DT-list, DT-vector |
DT-integer |
|
DT-matrix |
DT-index |
|
DT-hash |
DT-datatype |
|
|
DT-void |
N |
<- Count
0 … INT_MAX |
Number of values (excluding the default values with the indexes [0], [0,*] or [*,0]). |
DM-Value |
Highest index value, may be either void (scalar value), an integer value (one-dimensional array), an index value (two-dimensional array), or a data type (associative array). |
Return value
DM-status of DM-StdArgs
DM-error |
The number of values could not be determined. This may be due to a faulty call or an unmanaged or invalid value reference. |
DM-success |
Querying the number of values has been successful. |
Availability
COBOL Interface for Micro Focus Visual COBOL only.
See also