6.8.63 DMcob_ValueIndex
This function can be used to determine the corresponding index for a position in a collection. This is especially important for values of type DT-hash and DT-matrix in order to access all respective indexes the easiest way. The function only allows access to indexes that do not belong to default values.
The returned index can be stored in a managed DM-Value parameter value or in an unmanaged one. In the latter case, the string value is allocated in the temporary buffer if necessary.
77 AnyValue pointer value null. 77 IndexPos pic 9(9) binary value 0. call “DMcob_ValueIndex” using DM-StdArgs AnyValue IndexPos DM-Value.
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 index for the position will be retrieved.
-> IndexPos
This parameter defines the position of the index and should be in the range 0 < IndexPos <= DMcob_ValueCount().
<- DM-Value
The respective index is stored here. This may be a managed or an unmanaged value reference.
Return value
DM-status of DM-StdArgs
DM-error |
The index could not be determined. This may be due to an faulty call, an unmanaged or invalid value reference, or an incorrect position. |
DM-success |
The value has an index at this position; the obtained index can afterward be found in DM-Value if DM-Value != NULL. |
Availability
COBOL Interface for Micro Focus Visual COBOL only.
See also
Method :index()