DB2 conversion problem

Ask question on - DataBase Concepts, IBM Mainframe DB2, DB2/UDB, DB2 Tools, SQL , DB2 programming with languages like COBOL, PL1.

Moderators: Kalicharan, Moderator Group

Post Reply
dharmendra87
Member
Posts: 4
Joined: Mon Dec 30, 2013 7:04 pm

DB2 conversion problem

Post by dharmendra87 » Mon Dec 30, 2013 7:10 pm

Hi All, i am beginner in DB2 and i am trying to convert MS SQL into DB2 but i getting error at the time of conversion, i have attched my code below.//

Code: Select all

CREATE FUNCTION [dbo].[Split](PMCString Varchar(8000),PMCDelimiter Char(1))        
Returns temptable TABLE (items Varchar(8000))        
LANGUAGE SQL
CONTAINS SQL
DETERMINISTIC
NO EXTERNAL ACTION
BEGIN
    DECLARE idx Integer        
    DECLARE slice Varchar(8000)          
    Select idx = 1        
        If len&#40;PMCString&#41;<1 or PMCString is null  Return               
    While idx!= 0        
    BEGIN        
        Set idx = Charindex&#40;PMCDelimiter,PMCString&#41;        
        If idx!=0        
            Set slice = left&#40;PMCString,idx - 1&#41;        
        else        
            Set slice = PMCString        
           
        If&#40;len&#40;slice&#41;>0&#41;   
            Insert into temptable&#40;Items&#41; Values&#40;slice&#41;        
        Set PMCString = right&#40;PMCString,len&#40;PMCString&#41; - idx&#41;        
        If len&#40;PMCString&#41; = 0 break        
    END    
Return        
END;
Thanks & Regards
Dharmenra Kr. Yadav

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Dec 30, 2013 10:53 pm

You need to also post the diagnostic information you received.

Also, you should use the Code tags when posting things that need to retain alignment.

Your duplicate topic has been locked. If you have more info, reply to this topic.
Have a good one

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others