OSI/MHS Gateway Programmatic Interface (GPI) Programming Guide

Writing Your Program
OSI/MHS Gateway Programmatic Interface (GPI) Programming Guide424822-001
5-24
Building a Root Object
of string data. As shown, 20 is specified for string-offset, indicating
GPI_OM_WRITE_ will add to the end of this string. An element-number of 10 is
specified, indicating the string to be written is 10 octets. The buffer that contains the
string to be written by GPI_OM_WRITE_ is called Buffer_Y.
After the call, the string buffer for value 0 of attribute A is shown with the additional
10 octets. As shown in the output parameter box, a string offset of 30 is returned. This
is provided as a starting point for a subsequent call to GPI_OM_WRITE_ .
It is important to note that, should you write to the middle of a buffer, you might lose
data that follows the newly written string. For example, Figure 5-5 shows the effect of a
subsequent call to GPI_OM_WRITE_ on the same string buffer. For this call, all input
parameters are the same, except string-offset is now specified as 5.
The 10 octets of data is written, starting at an offset of 5. The new data overwrites 10
octets of data that previously existed at that position. In addition, 15 octets of data
following that position are lost.
Example: Writing a Long String to an Attribute Value
The following TAL example shows a call to GPI_OM_WRITE_ .
Data declarations:
literal IGNORED_FOR_SINGLE_VALUED_ATT = 0D;
INT
status, -- STATUS code
attribute_type := IM_T_TEXT, -- Attribute to which string
-- segment is written
Figure 5-5. Using GPI_OM_WRITE_ (To Write to the Middle of a String Buffer)
505CDT .CDD
Input Parameters
GPI_OM_WRITE_ String Buffer (Buffer_Y)
01020304050octets
String Buffer for Attribute A, Value 0 (of Object X)
01020304050octets
Output Parameter
string offset: 15
String Buffer for Attribute A, Value 0 (of Object X)
0 1020304050octets
object: OBJECT_X_ID
attribute-type: Attribute Type A
value-position: 0
string offset: 5
data-string: Buffer_Y
element-number: 10