Showing posts with label cobol. Show all posts
Showing posts with label cobol. Show all posts

Wednesday, March 7, 2012

COBOL program output "text" file for SQL Server to read?

Hello
When a COBOL program outputs a "text" file how can SQL Server read that text
file?winlin,
You can import it a number of ways. Read about BCP or BULK INSERT and its
format files. I am assuming that you will need to give some instruction via
the format file about how to parse the "text" file.
Or you may insert it into a staging table with a format something like:
CREATE TABLE CobolStaging
(LineOfCobolText NVARCHAR(1000))
Further, I am assuming that every line is in the same format, so that it can
be viewed as a row in a table. But if that is not the case, then the
reading in is more complex since it would probably be row order dependent
how to interpret the data. (E.g. header rows and detail rows. In that
case, use a table like:
CREATE TABLE CobolStaging
(LineNum INT IDENTITY(1,1)
LineOfCobolText NVARCHAR(1000))
You will need a format file to teach it to skip over the LineNum column when
importing.
After you have read and experimented with BCP you will probably have some
new questions.
RLF
"winlin" <winlin@.verizon.com> wrote in message
news:40E16360-C774-43A6-B4A9-B1B7B5FC4F2B@.microsoft.com...
> Hello
> When a COBOL program outputs a "text" file how can SQL Server read that
> text
> file?

cobol -> SQL2005

I'm not "cobol person" but now, I have to bind a cobol application (from mainframe) to query SQL 2005
Have somebody had this task?No, but it should be pretty straightforward... All of the mini / mainframe products I've seen use ODBC to allow native applications running on the host (the mini or the mainframe) to bind to the PC database. Operative word being "should", this should be quite straightforward, simply changing the ODBC driver referenced and setting the server / database / security settings appropriately.

-PatP|||No, but it should be pretty straightforward... All of the mini / mainframe products I've seen use ODBC to allow native applications running on the host (the mini or the mainframe) to bind to the PC database. Operative word being "should", this should be quite straightforward, simply changing the ODBC driver referenced and setting the server / database / security settings appropriately.

-PatP

Thanks Pat
I try to find communication between Mainframe and PC db throgh ODBC :).
This cobol-programm never have been running to bind to the PC db - it is working with mainframe DB2. This is tamporary deal (we are going from DB2-to SQL2005) I could write this from PC using VS C# for example and hit mainframe, but I have to save even interface of this "stupid" programm :).

thanks again|||how about "Connect Direct" or "Direct Connect" ?|||wath do you mean?

Actually, now I'm studing how to do this for IBM CICS environment that uses EXEC SQL CONNECT to DB2 to change to SQL2005