AXDEFGEN COPY Files

Following is a list of TYPE codes that you might find in a COPY file generated by AXDEFGEN. The TYPE names are acronyms and/or abbreviations for the type descriptions. VT stands for Variant Type. For example, VT_I2 is a type of variant that contains a 2-byte signed integer. VT_UI2 is a 2-byte unsigned integer. VT_R4 is a 4-byte real number (floating point). For a more complete reference of these codes, refer to the Microsoft Developer's Network at msdn.microsoft.com.

Note that you may pass an alphanumeric data item or literal as a parameter to a property or method that expects a numeric item. The runtime automatically "parses" the alphanumeric string and extracts a number from it if possible.

In general, if a parameter is passed by reference (usually an I/O or output parameter), then it has 16384 (hex 4000) added to its value in the COPY file. For example a boolean output parameter would be 16384 + 11 (the value for VT-BOOL), or 16395. For this reason, if the TYPE in the COPY file is between 16384 and 16456, then you can subtract 16384 to find the associated TYPE code.

This table also includes possible C types that you may find in AXDEFGEN COPY files along with the corresponding COBOL data class.

AXDEFGEN COPY File Type Codes

TYPE Code   TYPE Name C Type COBOL Data Class Description of Data
VT_EMPTY void N/A Nothing
1 VT_NULL null numeric SQL style Null; any numeric data item, 0, zero, null, or low-values
2 VT_I2 short numeric 2-byte signed int; a 16-bit signed integer, any numeric data item or literal
3 VT_I4 int numeric 4-byte signed int; a 32-bit signed integer, any numeric data item or literal
4 VT_R4 single numeric 4-byte real; a single (4-byte) floating point number, any numeric data item or literal, typically USAGE FLOAT
5 VT_R8 double numeric 8-byte real; a double (8-byte) floating point number, any numeric data item or literal, typically USAGE DOUBLE
6 VT_CY CURRENCY numeric Currency; a currency value, any numeric data item or literal, usually containing a decimal point
7 VT_DATE DATE alphanumeric Date; a date in either numeric or alphanumeric form
8 VT_BSTR BSTR alphanumeric COM Automation string; a character string, any data item or literal, typically USAGE DISPLAY
9 VT_DISPATCH IDispatch numeric IDispatch; a pointer to the IDispatch interface, a USAGE POINTER, or USAGE HANDLE item
10 VT_ERROR SCODE numeric SCODE; a 32-bit unsigned integer, any numeric data item or literal
11 VT_BOOL boolean numeric True=-1, False=0; any alphanumeric or numeric data item or literal, pass 1, -1 or "True" for True, 0 or "False" for False
12 VT_VARIANT VARIANT any VARIANT; any alphanumeric or numeric data item or literal
13 VT_UNKNOWN IUnknown numeric IUnknown; a pointer to the IUnknown interface, a USAGE POINTER, or USAGE HANDLE item
14 VT_DECIMAL N/A numeric 16-byte fixed point
16 VT_I1 char alphanumeric Signed char; a single 8-bit signed character, any data item or literal, typically USAGE DISPLAY
17 VT_UI1 unsigned char numeric Unsigned char; a single 8-bit unsigned character, any numeric data item or literal
18 VT_UI2 unsigned short numeric Unsigned short; a 16-bit unsigned integer, any numeric data item or literal
19 VT_UI4 unsigned long numeric Unsigned long; a 32-bit unsigned integer, any numeric data item or literal
20 VT_I8 int64 numeric Signed 64-bit int; a 64-bit signed integer, any numeric data item or literal
21 VT_UI8 uint64 numeric Unsigned 64-bit int; a 64-bit unsigned integer, any numeric data item or literal
22 VT_INT int numeric Signed machine int; a 32-bit signed integer, any numeric data item or literal
23 VT_UINT unsigned int numeric Unsigned machine int; a 32-bit unsigned integer, any numeric data item or literal
24 VT_VOID void N/A C style void
25 VT_HRESULT HRESULT numeric Standard return type; a 32-bit unsigned integer, any numeric data item or literal
26 VT_PTR PTR numeric Pointer type; a USAGE HANDLE or USAGE POINTER data item
27 VT_SAFEARRAY SAFEARRAY table One- or two-dimensional table with one USAGE HANDLE or USAGE HANDLE OF VARIANT elementary item
28 VT_CARRAY CARRAY N/A C style array
29 VT_USERDEFINED USERDEFINED N/A User-defined type
30 VT_LPSTR LPSTR alphanumeric   Null terminated string; any alphanumeric data item or literal
31 VT_LPWSTR LPWSTR alphanumeric Wide null terminated string; any alphanumeric data item or literal
36 VT_RECORD   N/A User-defined type
64 VT_FILETIME FILETIME N/A FILETIME
65 VT_BLOB BLOB N/A Length prefixed bytes
66 VT_STREAM STREAM N/A Name of the stream follows.
67 VT_STORAGE STORAGE N/A Name of the storage follows.
68 VT_STREAMED _OBJECT STREAMED _OBJECT N/A Stream contains an object.
69 VT_STORED _OBJECT     STORED _OBJECT    N/A Storage contains an object.
70 VT_BLOB_OBJECT BLOB_OBJECT N/A Blob contains an object.
71 VT_CF CF N/A Clipboard format
72 VT_CLSID CLSID alphanumeric A Class ID; any alphanumeric data item or literal   

If DATE is in numeric form, days are represented by whole number increments starting with 30 December 1899, midnight as time zero. Hour values are expressed as the absolute value of the fractional part of the number. For example:

0.00 is 30 December 1899, 12:00 A.M.

5.25 is 4 January 1900, 6 A.M.

5.875 is 4 January 1900, 9 P.M.

If DATE is in alphanumeric form, the date can be in a variety of formats. For example, the following are all valid formats:

"25 January 1996"

"8:30:00"

"20:30:00"

"January 25, 1996 8:30:00"

"8:30:00 Jan. 25, 1996"

"½5/1996 8:30:00"

You may pass a USAGE POINTER item that was filled in by a prior method or property call, or you may pass a USAGE HANDLE item which contains a handle to an ActiveX control or COM object. You may not pass a Screen Section item name as a handle of an ActiveX control. Instead, use the Format 11 SET verb to get a handle to the ActiveX control (e.g., SET my-handle to HANDLE OF screen-section-item). The IUnknown interface is part of the Microsoft COM standard. Any COM object or ActiveX control exports interfaces that are used to create, use, and destroy objects. Each interface is based on a single interface called IUnknown. This means that you may pass a pointer to any of these interfaces (objects) to a method or property that expects an IUnknown*.

The runtime automatically converts a handle to an ActiveX control or COM object to the IUnknown* type when you pass it to a method or property.

Any of these types may be followed by an asterisk to indicate that the parameter will be passed "by reference". This means that the ActiveX control or COM object method or property may modify the contents of the passed data item.

Any type name other than those in the list is a user-defined type. User-defined types are those that are created by the ActiveX control or COM object programmer or vendor. They always resolve to one of the types in the list but have different names to indicate their functions. For example, OLE_COLOR is a user-defined type that is commonly used to represent colors in ActiveX controls and COM objects. It resolves to a unsigned long which is a 32-bit unsigned integer. You must read the programmer's documentation of the particular ActiveX control or COM object in order to determine how to use user-defined types. For example, after reading about OLE_COLOR you may learn a formula to allow you to construct an OLE_COLOR if you know the red (0-255), green (0-255), and blue (0-255) components of the color you are trying to represent.

Another common user-defined type is IFontDisp*. This type is used to represent fonts. Some ActiveX controls and/or COM objects have properties whose values are fonts, or methods whose parameters are fonts. You may use INQUIRE to get a IFontDisp* into a HANDLE OF IFontDisp item. IFontDisp is defined in "acuclass.def". Then you may modify the NAME, SIZE, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, WEIGHT, or CHARSET properties of the IFontDisp item using the MODIFY verb. For example:

copy "acuclass.def"
...
77  my-font-disp  usage handle of IFontDisp
...
INQUIRE Calendar-1 DayFont in my-font-disp.
MODIFY my-font-disp Name = "Courier New"
     @Size = 15, Bold = 1.
Note: Because SIZE is a common ACUCOBOL-GT property name, @Size uses the "at" sign to distinguish it as an ActiveX property name.

Alternatively, you may use the double colon ("::") operator to set these properties in a single MODIFY statement. For example:

MODIFY Calendar-1 DayFont::Name = "Courier New"
    DayFont::Size = 15, DayFont::Bold = 1.

In this case, you do not use a HANDLE OF IFontDisp item. Instead, the runtime creates a temporary HANDLE OF IFontDisp item, does the INQUIRE, and sets the properties "behind the scenes" in the processing of the MODIFY statement.

Another user-defined type that you might see is DataSource*, which is sometimes used as the value of a DataSource property in an ActiveX control. It resolves to the IUnknown * type. For example, to use the Microsoft DataGrid control and the Microsoft ADO control together, set the DataGrid control's DataSource property to the IUnknown* of the ADO control. As stated above, to pass an ActiveX control or COM object as a IUnknown* you must pass the handle of the control or COM object.

For example:

01  main-screen.
    03 adoctrl, Adodc,
       COL 14 LINE 21 LINES 2.20 CELLS
       SIZE 29.00 CELLS
       LICENSE-KEY "C4145310-469C-11d1-B182-00A0C922E820".
    03 testgrid, Datagrid,
       COL 14 LINE 9 LINES 10 CELLS
       SIZE 28 CELLS
       LICENSE-KEY "CDE57A55-8B86-11D0-b3C6-00A0C90AEA82".

    03 PUSH-BUTTON LINE 27 COL 23 TITLE "Exit"
       CANCEL-BUTTON LINES 4 CELLS SIZE 10 CELLS.

...

DISPLAY main-screen.

MODIFY adoctrl ConnectionString = "DSN=Customers".
MODIFY adoctrl DatasourceName = "Customers".
MODIFY adoctrl RecordSource = "Select * from publishers".

MODIFY testgrid Caption = "Test".
SET adoctrl-handle TO HANDLE OF adoctrl.
MODIFY testgrid DataSource = adoctrl-handle.

DISPLAY testgrid.

The handle of the "adoctrl" is obtained with the SET verb. It is then passed as the value of the DataSource property in the MODIFY statement that follows.