Highlighted
Absent Member.
Absent Member.
750 views

ADO

Hello,

I'm tryin to use the following statement in one of my managed Cobols:

EXEC ADO

   GET CONNECTION INTO :MyConnection

END-EXEC.

How should I declare the MyConnection field in my Cobol program.

I tried this:

01 MyConnection TYPE System.Data.SqlClient.SqlConnection.

But I get the following compiler error:

Error 1 COBES0100 : Incorrect SQL statement syntax near: xxxxx

Any ideas?

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: ADO

Define it as

01 myconnection   object.

You can then cast it to a different type after

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: ADO

The documentation show the following syntax:

          EXEC ADO

               GET CONNECTION INTO :myConnection  TRANSACTION INTO :myTransaction

          END-EXEC

This format works for me.

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.