I have a VB4 app that makes a call to a mf cobol dll and returns some values. I now have migrated my VB4 to VB6 and when I make the call I'm getting incorrect values returned?? Does anyone have any solutions?? This is really urgent??
Without looking at your code, I can only make educated guesses.
Off the top of my head, VB4 and VB6 have a difference in certain data type alignments. Consider the following:
Option Explicit
Type MyType
l as Long
i as Integer
End Type
The size of MyType is 6 in VB4 and 8 in VB6. VB6 adds padding at the end of Long, because the space Long occupies must be a multiple of the Long data type. Also, Long starts at a byte that is a multiple of Long (4), and Integer starts at a byte that is a multiple of Integer (2).
Type typMiscInputCbl
strStatusVal As String * 24
intInterruptFlag As Integer
intTranCnt As Integer
intAttAge477Flag As Integer
strCallFromVBFlag As String * 1
strBasicFiller As String * 27
End Type
What kind of incorrect values do you receive?
How do you send the UDT to COBOL (Function Declaration, ByVal, etc..)?
What does the PROCEDURE DIVISION statement say (in COBOL)?
Are the call to COBOL, the UDT and the COBOL code untouched when migrating to vb6?
Try to use the following code to find out the real length of your UDT (this should show if any padding occurs):
Dim udtLength As typMiscInputCbl
MsgBox LenB(udtLength)
It is also possible that Win32 environments such as Windows 98 and Windows NT, strings are Unicode (each character using 2 bytes of memory). Has the machine or OS changed during the upgrade?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.