Skip to main content

[Migrated content. Thread originally posted on 17 February 2011]

We are investigating the possibility to migrate our product to Cobol.net using Visual COBOL.

We have successfully opened our ISAM files using the Cobol File handler with help from Micro Focus Staff (Thanks!!!) - we can now iterate through an ISAM file and read data.

Now as a next step we're trying to get ADO.NET to work - we want to use an ADO recordset that we then fill using our ISAM data.

This may be a simple question but can anyone please explain how to declare an ADO.NET recordset? Our goal is to iterate throught the records moving filling ISAM field contents to ADO.NET recordset fields. ADO is not listed in our references screen, it seems as though it simply does not exist!? - we're using the 30days trial version of Visual COBOL R3.

So we can't figure out how to use somthing like this:

adoRS.MoveFirst
adoRS.MoveNext
adoRS.Fields("fieldname").Value = "value"

etcetera. The EXEC ADO we see in some examples is something we don't grasp, and we are unable to declare a variable of type ADO.RECORDSET

Any help would be greatly appreciated.

[Migrated content. Thread originally posted on 17 February 2011]

We are investigating the possibility to migrate our product to Cobol.net using Visual COBOL.

We have successfully opened our ISAM files using the Cobol File handler with help from Micro Focus Staff (Thanks!!!) - we can now iterate through an ISAM file and read data.

Now as a next step we're trying to get ADO.NET to work - we want to use an ADO recordset that we then fill using our ISAM data.

This may be a simple question but can anyone please explain how to declare an ADO.NET recordset? Our goal is to iterate throught the records moving filling ISAM field contents to ADO.NET recordset fields. ADO is not listed in our references screen, it seems as though it simply does not exist!? - we're using the 30days trial version of Visual COBOL R3.

So we can't figure out how to use somthing like this:

adoRS.MoveFirst
adoRS.MoveNext
adoRS.Fields("fieldname").Value = "value"

etcetera. The EXEC ADO we see in some examples is something we don't grasp, and we are unable to declare a variable of type ADO.RECORDSET

Any help would be greatly appreciated.
Not sure if this is what you are after. Have not tested it, but if you open a new project, add adodb to your references and this should compile:

program-id. Program1 as "AdoTest.Program1".

       data division.
       working-storage section.
       
       01 conn type ADODB.Connection.
       01 recset type ADODB.Recordset.
       01 fl type ADODB.Fields.

       procedure division.
           set conn to new type ADODB.Connection
           set recset to new type ADODB.Recordset
           invoke conn::Open("connection string", NULL, NULL, 0)
           invoke recset::Open("query string", conn, type ADODB.CursorTypeEnum::adOpenKeyset, type ADODB.LockTypeEnum::adLockOptimistic, -1)
           invoke recset::MoveFirst()
           invoke recset::MoveNext()
           set fl to recset::Fields
           set fl::Item("fieldname")::Value to "value"
           goback.
           
       end program Program1.

[Migrated content. Thread originally posted on 17 February 2011]

We are investigating the possibility to migrate our product to Cobol.net using Visual COBOL.

We have successfully opened our ISAM files using the Cobol File handler with help from Micro Focus Staff (Thanks!!!) - we can now iterate through an ISAM file and read data.

Now as a next step we're trying to get ADO.NET to work - we want to use an ADO recordset that we then fill using our ISAM data.

This may be a simple question but can anyone please explain how to declare an ADO.NET recordset? Our goal is to iterate throught the records moving filling ISAM field contents to ADO.NET recordset fields. ADO is not listed in our references screen, it seems as though it simply does not exist!? - we're using the 30days trial version of Visual COBOL R3.

So we can't figure out how to use somthing like this:

adoRS.MoveFirst
adoRS.MoveNext
adoRS.Fields("fieldname").Value = "value"

etcetera. The EXEC ADO we see in some examples is something we don't grasp, and we are unable to declare a variable of type ADO.RECORDSET

Any help would be greatly appreciated.
Now this is odd. I am 100% sure I searched for something like ADO in the references dialog screen but couldn't find it. Now I try again, according to your reply and I immediately see adodb right there in the list.... Why it wasn't there before I don't know.

So I think we're able to continue. Thanks a lot for your fast reply, support is great over here ;)

[Migrated content. Thread originally posted on 17 February 2011]

We are investigating the possibility to migrate our product to Cobol.net using Visual COBOL.

We have successfully opened our ISAM files using the Cobol File handler with help from Micro Focus Staff (Thanks!!!) - we can now iterate through an ISAM file and read data.

Now as a next step we're trying to get ADO.NET to work - we want to use an ADO recordset that we then fill using our ISAM data.

This may be a simple question but can anyone please explain how to declare an ADO.NET recordset? Our goal is to iterate throught the records moving filling ISAM field contents to ADO.NET recordset fields. ADO is not listed in our references screen, it seems as though it simply does not exist!? - we're using the 30days trial version of Visual COBOL R3.

So we can't figure out how to use somthing like this:

adoRS.MoveFirst
adoRS.MoveNext
adoRS.Fields("fieldname").Value = "value"

etcetera. The EXEC ADO we see in some examples is something we don't grasp, and we are unable to declare a variable of type ADO.RECORDSET

Any help would be greatly appreciated.
Hi Robert,

If you're working with ADO.NET, you may also want to look at the EXEC ADO syntax provided with the product on Windows...

It's documented within the Programming > Database Access topic within the online help, and there's also some sample programs - specifically OrderStatusDemo - that shows how you can use EXEC ADO syntax to work with .NET object such as datasets.

[Migrated content. Thread originally posted on 17 February 2011]

We are investigating the possibility to migrate our product to Cobol.net using Visual COBOL.

We have successfully opened our ISAM files using the Cobol File handler with help from Micro Focus Staff (Thanks!!!) - we can now iterate through an ISAM file and read data.

Now as a next step we're trying to get ADO.NET to work - we want to use an ADO recordset that we then fill using our ISAM data.

This may be a simple question but can anyone please explain how to declare an ADO.NET recordset? Our goal is to iterate throught the records moving filling ISAM field contents to ADO.NET recordset fields. ADO is not listed in our references screen, it seems as though it simply does not exist!? - we're using the 30days trial version of Visual COBOL R3.

So we can't figure out how to use somthing like this:

adoRS.MoveFirst
adoRS.MoveNext
adoRS.Fields("fieldname").Value = "value"

etcetera. The EXEC ADO we see in some examples is something we don't grasp, and we are unable to declare a variable of type ADO.RECORDSET

Any help would be greatly appreciated.
Robert, Are you using the .NET Framework ADO.NET classes? If so you'll need the namespaces: System.Data and System.Data.SqlClient.

You may want to check out: DataReader, DataSet, DataAdapter