I am trying to connect to MSSQL (2019) with Visual Studio 2019, with the full trial of Visual Cobol. not the PE. As i was told it has limitations, maybe SQL connection being one of them, i dont know..
Anyways would like to connect to an MSSQL database, run a query, that will fetch report data. Then try and i guess read it into tables, and chunks at a time, not sure if VC helps with that, at EOF, if that exists in SQL want to display the data.
1. How do you do the connection.
2. Reading into tables. in chunks, how do i preallocate the tables for the chunks of data.
I know there are videos, but so far those videos are dated. Have not found one step by step video, to show the steps.
not showing off, but if its any help, im a both an expert in COBOL and also in MSSQL so i just need to in between part with MF VC. So i know cobol tables inside out, even on a very high level, and i know tssql, with all aspects of the select statements. Joins, SQL REPORTING SERVICES etc.
thanks.
I am trying to connect to MSSQL (2019) with Visual Studio 2019, with the full trial of Visual Cobol. not the PE. As i was told it has limitations, maybe SQL connection being one of them, i dont know..
Anyways would like to connect to an MSSQL database, run a query, that will fetch report data. Then try and i guess read it into tables, and chunks at a time, not sure if VC helps with that, at EOF, if that exists in SQL want to display the data.
1. How do you do the connection.
2. Reading into tables. in chunks, how do i preallocate the tables for the chunks of data.
I know there are videos, but so far those videos are dated. Have not found one step by step video, to show the steps.
not showing off, but if its any help, im a both an expert in COBOL and also in MSSQL so i just need to in between part with MF VC. So i know cobol tables inside out, even on a very high level, and i know tssql, with all aspects of the select statements. Joins, SQL REPORTING SERVICES etc.
thanks.
After removing PE Visual Cobol and installing the 1 month trial of VC so I guess this is the version that includes it all. Was able to create an ADO connection string. Next step is how to add that to a native VC Cobol program in VS. And try and extract some simple data from the SQL database.
I am trying to connect to MSSQL (2019) with Visual Studio 2019, with the full trial of Visual Cobol. not the PE. As i was told it has limitations, maybe SQL connection being one of them, i dont know..
Anyways would like to connect to an MSSQL database, run a query, that will fetch report data. Then try and i guess read it into tables, and chunks at a time, not sure if VC helps with that, at EOF, if that exists in SQL want to display the data.
1. How do you do the connection.
2. Reading into tables. in chunks, how do i preallocate the tables for the chunks of data.
I know there are videos, but so far those videos are dated. Have not found one step by step video, to show the steps.
not showing off, but if its any help, im a both an expert in COBOL and also in MSSQL so i just need to in between part with MF VC. So i know cobol tables inside out, even on a very high level, and i know tssql, with all aspects of the select statements. Joins, SQL REPORTING SERVICES etc.
thanks.
The documentation is usually a good place to start:
Database Access<>
Demonstrations of Native COBOL<> which has a section with SQL Program Examples
The Samples Application under the Micro Focus Section on the Windows Start Menu that you were pointed to on other queries
You don't mention which database you want to use and there are difference in pre-processors and such most items will be dealt with above. And of course there is Google
"Embedded SQL COBOL SQL SERVER"
"Embedded SQL Connect Statement"
"embedded sql connect to database"
Not to mention IBM, Oracle and other all provide sample SQL COBOL programmers with their database SDK's.
You have a lot of reading and learning in front of you as you learn to work with embedded SQL in high level languages.
I am trying to connect to MSSQL (2019) with Visual Studio 2019, with the full trial of Visual Cobol. not the PE. As i was told it has limitations, maybe SQL connection being one of them, i dont know..
Anyways would like to connect to an MSSQL database, run a query, that will fetch report data. Then try and i guess read it into tables, and chunks at a time, not sure if VC helps with that, at EOF, if that exists in SQL want to display the data.
1. How do you do the connection.
2. Reading into tables. in chunks, how do i preallocate the tables for the chunks of data.
I know there are videos, but so far those videos are dated. Have not found one step by step video, to show the steps.
not showing off, but if its any help, im a both an expert in COBOL and also in MSSQL so i just need to in between part with MF VC. So i know cobol tables inside out, even on a very high level, and i know tssql, with all aspects of the select statements. Joins, SQL REPORTING SERVICES etc.
thanks.
i know to connect to sql should be super simple. however, nothing about the instructions out there are simple, everything is just made so theoretical, that you need to guess what they mean. Just a simple example would do, i would be able to figure out the rest. thanks.
i know to connect to sql should be super simple. however, nothing about the instructions out there are simple, everything is just made so theoretical, that you need to guess what they mean. Just a simple example would do, i would be able to figure out the rest. thanks.
https://www.microfocus.com/documentation/visual-cobol/vc60/VS2019/HRDBRHESQL07.html
i know to connect to sql should be super simple. however, nothing about the instructions out there are simple, everything is just made so theoretical, that you need to guess what they mean. Just a simple example would do, i would be able to figure out the rest. thanks.
If this is a native COBOL program then you need to create an ODBC DSN using the ODBC Administration tool. If this is Windows 10 then search for ODBC in the search bar and select either the 32-bit or 64-bit version depending on the bitism of your application.
After creating the DSN you can use its name in the connect statement. If you are using Integrated Windows Authentication in your DSN or you provided a user name and password then you should be able to connect with:
EXEC SQL CONNECT TO 'myDSN' END-EXEC
If you need to provide a user name and password then you could use:
EXEC SQL CONNECT TO 'myDSN' USER 'username.password' END-EXEC
There is a sample program in the Samples Browser called OESQL - Connect under the SQL category which shows a number of different options.
There is also a video which covers this here:
I am trying to connect to MSSQL (2019) with Visual Studio 2019, with the full trial of Visual Cobol. not the PE. As i was told it has limitations, maybe SQL connection being one of them, i dont know..
Anyways would like to connect to an MSSQL database, run a query, that will fetch report data. Then try and i guess read it into tables, and chunks at a time, not sure if VC helps with that, at EOF, if that exists in SQL want to display the data.
1. How do you do the connection.
2. Reading into tables. in chunks, how do i preallocate the tables for the chunks of data.
I know there are videos, but so far those videos are dated. Have not found one step by step video, to show the steps.
not showing off, but if its any help, im a both an expert in COBOL and also in MSSQL so i just need to in between part with MF VC. So i know cobol tables inside out, even on a very high level, and i know tssql, with all aspects of the select statements. Joins, SQL REPORTING SERVICES etc.
thanks.
Well since no response yet on how to connect to SQL, Microsoft SQL. What i am doing is creating the query in MS SQL, whatever it is, and then saving it as a CSV., sometimes the results are 50 record sometimes 1000s of records. Then i read in the csv file into a cobol program, simply insert it into a table, and process it from there. I simply unstring by commas.
The advantage i have when i use a raw csv file, is that i can create the tables dynamically, so i never need to know the tables dimensions before hand.
I am not sure if i access sql directly, if i can still create the tables dynamically based on the query set.
But eventually i want to run the queries from cobol, and insert the data directly into the fields. I know it can be done and is quite easy, but what rules Micro Focus has about this, is written in manuals, but not easy to understand. Like i said a very simple example would do. If any experts are available, would be appreciated.
The documentation is usually a good place to start:
Database Access<>
Demonstrations of Native COBOL<> which has a section with SQL Program Examples
The Samples Application under the Micro Focus Section on the Windows Start Menu that you were pointed to on other queries
You don't mention which database you want to use and there are difference in pre-processors and such most items will be dealt with above. And of course there is Google
"Embedded SQL COBOL SQL SERVER"
"Embedded SQL Connect Statement"
"embedded sql connect to database"
Not to mention IBM, Oracle and other all provide sample SQL COBOL programmers with their database SDK's.
You have a lot of reading and learning in front of you as you learn to work with embedded SQL in high level languages.
like is said, connecting to sql should be very easy, as i have connected to sql from many other programs, it being a piece of cake. but in MF the answers you get here, is, yes go read like 300 pages from 17 different manuals, and good luck.
like is said, connecting to sql should be very easy, as i have connected to sql from many other programs, it being a piece of cake. but in MF the answers you get here, is, yes go read like 300 pages from 17 different manuals, and good luck.
https://www.microfocus.com/documentation/visual-cobol/vc60/EclWin/BKGTGTESQL.html
Well since no response yet on how to connect to SQL, Microsoft SQL. What i am doing is creating the query in MS SQL, whatever it is, and then saving it as a CSV., sometimes the results are 50 record sometimes 1000s of records. Then i read in the csv file into a cobol program, simply insert it into a table, and process it from there. I simply unstring by commas.
The advantage i have when i use a raw csv file, is that i can create the tables dynamically, so i never need to know the tables dimensions before hand.
I am not sure if i access sql directly, if i can still create the tables dynamically based on the query set.
But eventually i want to run the queries from cobol, and insert the data directly into the fields. I know it can be done and is quite easy, but what rules Micro Focus has about this, is written in manuals, but not easy to understand. Like i said a very simple example would do. If any experts are available, would be appreciated.
I am not sure if you actually read any of the responses that we post here. Please let me know if you see this one because we have responded to every question you have had and you keep saying that nobody has responded yet.
I gave you a response on this thread that showed you how to connect, pointed you at a sample program (actually many samples for SQL in the browser) and provided a video link. Short of actually coding it for you I am unsure of what else you are looking for?
Well since no response yet on how to connect to SQL, Microsoft SQL. What i am doing is creating the query in MS SQL, whatever it is, and then saving it as a CSV., sometimes the results are 50 record sometimes 1000s of records. Then i read in the csv file into a cobol program, simply insert it into a table, and process it from there. I simply unstring by commas.
The advantage i have when i use a raw csv file, is that i can create the tables dynamically, so i never need to know the tables dimensions before hand.
I am not sure if i access sql directly, if i can still create the tables dynamically based on the query set.
But eventually i want to run the queries from cobol, and insert the data directly into the fields. I know it can be done and is quite easy, but what rules Micro Focus has about this, is written in manuals, but not easy to understand. Like i said a very simple example would do. If any experts are available, would be appreciated.
Do you ever read the responses, or do you simply not understand the responses.
In this note stream you were provide the code in COBOL to do a Connect to a database. It will work for any database that support ODBC connections. The response also included a video that shows it it as well.
You were pointed to code in the documents on how to connect to a database with the different SQL Connect Flavors.
Did you look up SQL Connect in the Docs? Search for OpenESQL in the Docs and in the sample and Tutorials.
Do you know how to create an ODBC Connection?
I am not sure if you actually read any of the responses that we post here. Please let me know if you see this one because we have responded to every question you have had and you keep saying that nobody has responded yet.
I gave you a response on this thread that showed you how to connect, pointed you at a sample program (actually many samples for SQL in the browser) and provided a video link. Short of actually coding it for you I am unsure of what else you are looking for?
Very Good and correct Answer , Chris!
And in this forum there are full source code
I am trying to connect to MSSQL (2019) with Visual Studio 2019, with the full trial of Visual Cobol. not the PE. As i was told it has limitations, maybe SQL connection being one of them, i dont know..
Anyways would like to connect to an MSSQL database, run a query, that will fetch report data. Then try and i guess read it into tables, and chunks at a time, not sure if VC helps with that, at EOF, if that exists in SQL want to display the data.
1. How do you do the connection.
2. Reading into tables. in chunks, how do i preallocate the tables for the chunks of data.
I know there are videos, but so far those videos are dated. Have not found one step by step video, to show the steps.
not showing off, but if its any help, im a both an expert in COBOL and also in MSSQL so i just need to in between part with MF VC. So i know cobol tables inside out, even on a very high level, and i know tssql, with all aspects of the select statements. Joins, SQL REPORTING SERVICES etc.
thanks.
anyways will try to go through all the boring and difficult to read manuals with no clear examples on how to use sql with mf, thanks for all the amazing great help here.
Very Good and correct Answer , Chris!
And in this forum there are full source code
There is tons and tons of information. But its all theoretical.
Normally when i study something, the instructor will have a sample database, that i can copy, insert into my database. then will show the code they use to connect and some sample queries. I mean this is not complicated, this could be shown in a 3 minute video. But instead you are being directed to read manuals of stuff, that has nothing to do with the simplicity of the objective. After all connecting from phython or c, is so easy, why not make it easy for Cobol. I understand i probably will never get a simple answer to this problem, im kind of used to it on this board, which is a shame. Since this board should promote MF, not make it complex. Unfortunately, will need to wait until i meet a Programmer that connect to sql, and see their code, before i know how to do it. Reading those manuals, to me is a waste of time, and is good, once you have done it once, so you can see what other options exist. So if someone here, could give me the simple directions, of how to do a simple query with the code, I think i will help many who are trying to do the same. By the way, if you are using any of the MF licenses, never change your sys date, i did, and now cant use MF for 5 days straight, though they are trying to help me out. I will say this MF is a step above say some other solutions i have seen so far. But at this point since i cant use MF im using some other solution, with less features than MF, but it still gets the job done, and should i change the date, it wont blow up, and it lets me open multiple instances with no hitch. With MF i once opened a 2nd instance same pc, and poof, license was no longer valid. So far i need to step lightly and not go fancy, when using MF, not to get it upset, and lock me up.
There is tons and tons of information. But its all theoretical.
Normally when i study something, the instructor will have a sample database, that i can copy, insert into my database. then will show the code they use to connect and some sample queries. I mean this is not complicated, this could be shown in a 3 minute video. But instead you are being directed to read manuals of stuff, that has nothing to do with the simplicity of the objective. After all connecting from phython or c, is so easy, why not make it easy for Cobol. I understand i probably will never get a simple answer to this problem, im kind of used to it on this board, which is a shame. Since this board should promote MF, not make it complex. Unfortunately, will need to wait until i meet a Programmer that connect to sql, and see their code, before i know how to do it. Reading those manuals, to me is a waste of time, and is good, once you have done it once, so you can see what other options exist. So if someone here, could give me the simple directions, of how to do a simple query with the code, I think i will help many who are trying to do the same. By the way, if you are using any of the MF licenses, never change your sys date, i did, and now cant use MF for 5 days straight, though they are trying to help me out. I will say this MF is a step above say some other solutions i have seen so far. But at this point since i cant use MF im using some other solution, with less features than MF, but it still gets the job done, and should i change the date, it wont blow up, and it lets me open multiple instances with no hitch. With MF i once opened a 2nd instance same pc, and poof, license was no longer valid. So far i need to step lightly and not go fancy, when using MF, not to get it upset, and lock me up.
You evidently don't read the responses to your questions that you post so I am not sure why I am even responding here but I thought I would give it one more try.
Please read this thread from beginning to end and notice that there are page numbers that you can jump to as well. I have provided an example directly. I have pointed you to videos on how to use the various aspects of SQL within Visual COBOL. I have pointed you to the Samples Browser in the Windows Start menu Visual COBOL group which contains many SQL samples that use a provided sample database. Look at the Getting Started example for native code.
The Samples Browser is documented here.