Micro Focus Contributor
Micro Focus Contributor
1189 views

Help with VB to COBOL cpnvert - 105 memory allocation error

Jump to solution

[Migrated content. Thread originally posted on 10 August 2011]

Hi,

A client has a question relating to a VB to COBOL conversion, could I ask for assistance or advise on why the 105 memeory allocation error occurs:

SI2531170

Original text:
Hi I am trying to convert a vb program to cobol and have hit a snag that I do not know how to do it, can you help please. I have attached a test app, I am having trouble converting the following:
Call SetFpcCallback(Addressof FprCallback)

Private Sub SetFprCallback(ByVal lpFunc As Long)
Fpr1.FprCallback = lpfunc
End Sub

I think it is trying to pass the memory address of FprCallback to the sub program Fpr1.

In my Cobol program (Bacfpr.cbl) the relevant section is SET-CALLBACK, when I push the Push Button I get an error 105 Memory allocation error.

SET-CALLBACK section.

invoke Fpr "FprCallback"
using DataBlock-pointer

move FprCallback to FprCallback

* perform AUTO-SNAP

.

CAPTURE-TO-MEMORY section.

invoke Fpr "CopyCapImage"
using lpBuff
returning anInt

.


LMain-Process SECTION.
initialize w-validprints
PERFORM LProgram-Initialize
if w-ok = zero
PERFORM LProgram-Body until l-first = 3

.


I tried to attach the Cobol files but get a server error from the website.
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert
Kim,

From what I can tell from the post, the VB code is simply setting a function pointer. So the equivalent COBOL code is to define a PROCEDURE-POINTER, lets call it fprCallbackFunc and you set it by doing something like

set fprCallbackFunc to entry "the-function-to-point-to"

(I can't tell from a quick look at the code attached to the incident quite what it is trying to set the callback to)

and you can then pass it to the code that stores it via

invoke Fpr "setFprCallBack" using by value fprCallbackFunc

It should be as simple as that.

Gael

View solution in original post

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert
Kim,

From what I can tell from the post, the VB code is simply setting a function pointer. So the equivalent COBOL code is to define a PROCEDURE-POINTER, lets call it fprCallbackFunc and you set it by doing something like

set fprCallbackFunc to entry "the-function-to-point-to"

(I can't tell from a quick look at the code attached to the incident quite what it is trying to set the callback to)

and you can then pass it to the code that stores it via

invoke Fpr "setFprCallBack" using by value fprCallbackFunc

It should be as simple as that.

Gael

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.