Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

9.12.1 Converting VT_BSTR data

PowerCOBOL supports VT_BSTR data used for properties or parameters of a method as follows:

PowerCOBOL converts VT_BSTR data items to alpha-numeric text by default. But it gets converted to another type depending on the target data type. When executing a MOVE statement, VT_BSTR data gets changed to the same type as the receiving data item. In ADD, SUBTRACT and COMPUTE statements, it is changed to a numeric data type. For example, a numeric data type can be moved to the Text property of a TextBox control, which is VT_BSTR data, as follows:

 DATA DIVISION.
 WORKING-STORAGE SECTION.
 01  NUM  PIC S9(4) COMP-5  VALUE 0.
 PROCEDURE DIVISION.
     ...
     MOVE NUM TO "Text" OF CmText1

Note that it will not be converted between a property and another property. For example, the Style property of ComboBox control, which is VT_I2 data, cannot be moved to the Text property of a TextBox control.

      MOVE "Style" OF CmCombo1 TO "Text" OF CmText1  => wrong result

In this case, you should move the property to an intermediate data item to perform the proper conversion as follows:

DATA DIVISION.
 WORKING-STORAGE SECTION.
 01  NUM  PIC S9(4) COMP-5  VALUE 0.
 PROCEDURE DIVISION.
     ...
     MOVE "Style" OF CmCombo1 TO NUM
     MOVE NUM TO "Text" OF CmText1

9.12.1.1 Handling of spaces

PowerCOBOL handles space characters as follows:

All spaces at the end of a string are removed when the string is moved into a VT_BSTR data type. For example, if the following statement is executed, string " A" is displayed (" A " is not displayed).

      MOVE "  A  " TO "Caption" OF CmStatic1