Different COBOL compilers can generate data items differently. The following list contains some pointers that you should be aware of:
For example, IBM 370 SAA COBOL and MicroFocus COBOL support non-SIGN SEPARATE negative numbers differently. The mapping of positive to negative numbers is different. VisualAge provides classes to handle both compilers. Use AbtCOBOLHostNumericDisplay when working with IBM 370 SAA COBOL. Use AbtCOBOLNumericDisplay when working with MicroFocus COBOL and VisualAge for COBOL.
The C External Function part automatically manages pointers to simple data types. There are several behaviors that you should be aware of when manipulating pointers.
Pointer dereferencing for simple data types is accomplished using tear-off attributes. When an attribute with type AbtPointer is torn off, the resulting tear-off contains an attribute with a name matching that of the AbtPointer itself. This tear-off represents the dereferenced pointer that can be used to store data automatically into the pointer field and to retrieve data out of the pointer.
For example, consider the definition:
void myfunction ( long * field1 );
When the above definition is parsed from the C External Function prototypes page, the interface for the part is updated to include the parameter field1 (type=AbtPointer). At run time, this field stores the address of the long integer to be passed. AbtPointer fields can be stored and retrieved directly using this attribute.
When a tear-off attribute for field1 is created, the tear-off will also contain an attribute named field1 which represents the actual value of field1 (not the address of field1).
VisualAge does not automatically allocate memory for pointer fields. Rather, memory for an individual pointer field is allocated the first time data is stored into the field. Make sure that you initialize your pointer fields before you call your DLL.
Storing into char * fields
When VisualAge initially stores data into a pointer to char, memory is allocated with a size large enough to contain the initially stored string.