Not sure if it will work from mainframe COBOL, but from WINTEL COBOL (MicroFocus), this works: EXEC SQL
SELECT COLUMN_NAME
INTO :VARIABLE_NAME
FROM TABLE_NAME
WHERE COLUMN 1 = :VARIABLE1 AND
COLUMN 2 = 'Hard Coded Value'
END-EXEC.
============================================================
Since Microsoft is the DB vendor, all you need to do is obtain the appropriate ODBC or OLE DB or whatever type of driver function from them that they have available. Of course, Microsoft isn't known for supplying drivers for use on other platforms, so you might have to look for other possibilities.
Nowadays, the common solution has been to use JDBC with a Type 4 JDBC driver. Your COBOL would access a Java procedure on the mainframe that would use JDBC to interact with SQL Server. AFAIK, Microsoft's current JDBC is a type 4 driver. It requires JRE 5.0 or higher. I don't know how much info is available on installing this on a mainframe.
I'm not aware of any other possibilities without installing some intermediate product.
Tom
Last Wiki Answer Submitted: December 24, 2009 9:50 am by CO Bill120 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.