View previous topic :: View next topic
|
Author |
Message |
ashish tech
New User
Joined: 05 Dec 2007 Posts: 7 Location: Delhi
|
|
|
|
I am into a migration project. As part of that i need to convert DB2 to SQL server i.e. i need to make SQL queries (embedded in COBOL program) compatibale with SQL server. e.g. ':' is used in a COBOL-DB2 program for a host variable while '@' is used in SQL server for the same purpose. So if anybody can help me in either of the following:
a) Difference in SQLs in DB2 and SQL Server.
b) Any tool which converts SQL queries from DB2 to SQL server.
This is very urgent for me. please help. Let me know if you need more information.
Thanks,
Ashish |
|
Back to top |
|
|
dr_te_z
New User
Joined: 08 Jun 2007 Posts: 71 Location: Zoetermeer, the Netherlands
|
|
|
|
More info on platform/cobolcompiler/pre-compiler please.
As far as I know there is no pre-compiler for SQL-server. So, your cobol vendor has to do the trick. If that is Micro Focus or ACU, it should not be a problem. They can convert your SQL to ODBC-calls. |
|
Back to top |
|
|
ashish tech
New User
Joined: 05 Dec 2007 Posts: 7 Location: Delhi
|
|
|
|
yes, i m using microfocus and you are right that it will convert SQL to ODBC calls. But still i have issues:
a) SYNTAX difference in SQLs on DB2 and SQL SERVER
b) Corresponding SQLCODE on SQL SERVER. e.g. SQLCODE=-811 is for more than one row selected in DB2. What is the corresponding SQLCODE in SQLSERVER. As accordingly i need to handle the execution in the host program. Following is the list of SQLCODE on DB2 and i need corr SQLCODEs on SQLSERVER:
SQL CODE
0
100
-811
-803
-904
-913
-532
-530
-534
-501
-840
-911
-304 |
|
Back to top |
|
|
dr_te_z
New User
Joined: 08 Jun 2007 Posts: 71 Location: Zoetermeer, the Netherlands
|
|
|
|
[my personal option]
That list of negative sqlcodes is a result from sloppy programming in the past. SQLcode 0 and 100 are ANSI standards and the remaining is vendor-specific. You should never allow your program to continue when a sqlcode other than 0 or 100 has occured.
[/my personal option]
You're at a stage where you have to modify your programs.
you can do it quick & easy by looking for equivaltent sql codes for your new database vendor.... and do it again when you switch to oracle or back to db2....
or
improve the quality of you application by using more strict (ANSI/portable/agile) ) standards.
Getting a -811 is an error: treat is as such. code a "count(*)" or use a cursor if you're convinced that the SQL is 'right'.
coding '"insert" if duplicate key then "update"' is a trick. Do you allow tricks in your code? Why? There must be blocks of coding or else you should not have to worry about those codes (look at the new "merge" statement).
Clean your code until all the obscure SQL codes are eliminated and then port to windows on a friday afternoon without spoiling your weekend
The same for COBOL, use the ANSI85 flag to see which cobol-verbs are IBM-enhancements. Most of them are also known to Micro Focus, that's your luck, but still..... when you do adhere to ansi85 standards you can use open-cobol instead of Micro Focus and save yourself a lot of $$$ |
|
Back to top |
|
|
ashish tech
New User
Joined: 05 Dec 2007 Posts: 7 Location: Delhi
|
|
|
|
Thanks for ur help! |
|
Back to top |
|
|
|