IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SQL queries Conversion from DB2 to SQL Server


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ashish tech

New User


Joined: 05 Dec 2007
Posts: 7
Location: Delhi

PostPosted: Wed Dec 05, 2007 11:12 am
Reply with quote

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
View user's profile Send private message
dr_te_z

New User


Joined: 08 Jun 2007
Posts: 71
Location: Zoetermeer, the Netherlands

PostPosted: Wed Dec 05, 2007 12:26 pm
Reply with quote

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
View user's profile Send private message
ashish tech

New User


Joined: 05 Dec 2007
Posts: 7
Location: Delhi

PostPosted: Mon Dec 10, 2007 4:27 pm
Reply with quote

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
View user's profile Send private message
dr_te_z

New User


Joined: 08 Jun 2007
Posts: 71
Location: Zoetermeer, the Netherlands

PostPosted: Mon Dec 10, 2007 5:41 pm
Reply with quote

[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 icon_biggrin.gif

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
View user's profile Send private message
ashish tech

New User


Joined: 05 Dec 2007
Posts: 7
Location: Delhi

PostPosted: Mon Dec 17, 2007 12:36 pm
Reply with quote

Thanks for ur help!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts SMF Record Date conversion failing CLIST & REXX 1
No new posts Assembler class assignment: stuck on ... PL/I & Assembler 12
Search our Forums:

Back to Top