Connecting with variables to SQL with Cobol

  • This is the question: Can you use a variable as the ODBC name and database name in an ODBC connection to SQL Server (2012 R2).

    The problem is that the database name will change with each different client and would like to not have to recompile the program each time. The ODBC name could be the same or different each time depending on the number of clients, but would like to have a separate ODBC name and Database name for each one.

    Cobol Code:

    Exec SQL

    connect :ODBCName

    End-Exec.

    Exec SQL

    use :Databasename

    End_Exec.

    Where ODBCName and Databasename could be inputted with parameters or control cards.

    Any ideas? I've tried and can't seem to get it to work.

    Jim:hehe:

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply