MS SQL to DB2 Migration

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

Moderators: Kalicharan, Moderator Group

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

MS SQL to DB2 Migration

Post by dharmendra87 » Sat Jan 04, 2014 7:09 pm

// Hi all Please Resolve the error, actually i am trying to convert sql code to DB2

CREATE FUNCTION GetItemSrno (piID Integer ,SORID Integer)
RETURNS Integer
Language SQL
Contains SQL
BEGIN Atomic
Declare SrNo Integer Default 0;
Select SrNo =max(SrNo) from W_DSRGROUP where ParentID = piID and DSRID = SORID ;
Set SrNo = isnull(SrNo,0) + 1
Return (SrNo);
END


//Running
ADMINISTRATOR.GETITEMSRNO - Deploy started.
Create user-defined function returns SQLCODE: -104, SQLSTATE: 42601.
ADMINISTRATOR.GETITEMSRNO: 7: An unexpected token "Select" was found following "Integer Default 0". Expected tokens may include: "
".. SQLCODE=-104, SQLSTATE=42601, DRIVER=3.66.46

An unexpected token "Select" was found following "Integer Default 0". Expected tokens may include: "
".. SQLCODE=-104, SQLSTATE=42601, DRIVER=3.66.46

ADMINISTRATOR.GETITEMSRNO - Deploy failed.
ADMINISTRATOR.GETITEMSRNO - Roll back completed successfully.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sat Jan 04, 2014 10:04 pm

Please stop posting everything twice and when you do post please use the code tags for stuff code and data.
convert sql code to DB2
what rubbish. DB2 uses the Structured Query Language (SQL).
Regards
Nic

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

Post by DikDude » Sun Jan 05, 2014 2:36 am

And you have posted this multiple times :(

This duplicate is locked.

dd

Locked

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