Top
PowerCOBOL V11.0 Reference
FUJITSU Software

Appendix C Data Types

Because PowerCOBOL is designed to comply with the Component Object Model (COM) most properties and parameters are defined in terms of an OLE (Object Linking and Embedding) data type. Within this help system COBOL equivalents are always given first. The descriptions below provide fuller details of each of the OLE data types.

Note: The COBOL equivalents indicate only the standard definitions that correspond to the OLE VT data types. In some cases you may want to use more digits than provided in the COBOL definition, in which case you should define more digits in the PICTURE string. For example, OLE_COLOR has 4 bytes numeric with a COBOL equivalent of S9(9) COMP-5; however, the system color may contain 10 digits. In this case you would define the COBOL data as S9(10) COMP-5 - although this allocates 8 bytes of memory the higher 4 bytes are always zero so the item still maps to OLE_COLOR.

The following data types are used in objects provided by PowerCOBOL:

OLE Data Type

Description

VT_I2

A two byte numeric.

COBOL equivalent:S9(4) COMP-5

VT_I4

A four byte numeric.

COBOL equivalent:S9(9) COMP-5

OLE_COLOR

A four byte number defining a color.

COBOL equivalent:S9(9) COMP-5

The hexadecimal value of the four bytes (in the COMP-5 reverse order) is: X"rrggbbss"

When ss (the most significant byte) is X"00", "rr" is Red, "gg" is Green, "bb" is Blue.

When ss is X"80", "rr" contains a value indicating the system color value (listed below), and "gg" and "bb" should be zero.

Therefore, PowerCOBOL supports:
X"rrggbb00" (rr: Red, gg: Green, bb: Blue)
or
X"rr000080" (rr: as listed below)

00

Scroll bars

01

Desktop

02

Active title bar

03

Inactive title bar

04

Menu bar

05

Window background

06

Window frame

07

Menu text

08

Window text

09

Active title bar text

0A

Active window border

0B

Inactive window border

0C

Application workspace

0D

Highlight

0E

Highlighted text

0F

Button surface

10

Button shadow

11

Disabled text

12

Button text

13

Inactive title bar text

14

Button highlight

15

Button dark shadow

16

Button light shadow

17

Tool tip text

18

Tool tip background

You can set colors by using the color constants defined in PowerCOBOL (see "Appendix A. Color Constants" for details) or by coding the following in COBOL:

01 COLOR-VALUE PIC S9(9) COMP-5.
01 COLOR REDEFINES COLOR-VALUE PIC X(4).
*> Make the text color blue.
MOVE X"0000FF00" TO COLOR.
MOVE COLOR-VALUE
TO "ForeColor" OF StaticText1.
*> Make the character background red.
MOVE 255 TO "HighlightColor"
OF StaticText1.
*> Make the background color the button surface color.
MOVE X"0F000080" TO COLOR.
MOVE COLOR-VALUE TO "BackColor"
OF StaticText1.

Notes:

The byte order is reversed on Intel 80x86 processors - hence the hex values in the above examples.

You cannot store system color values in PIC S9(9) COMP-5 item because of decimal truncation. X"80xxxxxx" is equivalent to a 10 digit decimal number. Therefore, if you want to store a system color in a COBOL data item (e.g. in WORKING-STORAGE) you need to define it as PIC S9(10) COMP-5. This is not an issue if you move hex values to PowerCOBOL properties such as the ForeColor property.

VT_BOOL

A number indicating a True or False value.

Convention is that any non-zero value indicates True, zero indicates False. Generally -1 is used for the True value.

COBOL equivalent:S9(9) COMP-5

See "Appendix D. Boolean Constants" for constants to set and test VT_BOOL items.

VT_BSTR

A character string.

COBOL equivalent:X(8192)
(or an alphanumeric field up to 8192 bytes long)

VT_CY

Fixed point number.

COBOL equivalent:S9(14)V9(4)

The value of VT_CY can be between
-922337203685477.5808 and 922337203685477.5807.
(the integer part can be 15 digits and the decimal part can be 4 digits)

VT_R4

A four-byte floating-point number.

COBOL equivalent COMP-1.

VT_R8

An eight byte floating-point number.

COBOL equivalent:COMP-2

OLE_????_CONTAINER

Floating point number converted according to the coordinate system of the container.

"????" can be XPOS, YPOS, XSIZE, YSIZE.

COBOL equivalent:COMP-1

OLE_????_PIXELS

A four byte numeric containing coordinates in pixels. "????" can be XPOS, YPOS, XSIZE, YSIZE.

COBOL equivalent: S9(9) COMP-5

OLE_????_HIMETRIC

A four byte numeric containing coordinates by the himetric (1/100 mm).

"????" can be XPOS, YPOS, XSIZE, YSIZE.

COBOL equivalent: S9(9) COMP-5

VT_DISPATCH

A pointer to an object.

COBOL equivalent:OBJECT REFERENCE