Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

db2 user defined function in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Naga Rajender.K

New User


Joined: 19 Dec 2008
Posts: 13
Location: Hyderabad

PostPosted: Mon Jul 20, 2009 5:02 pm    Post subject: db2 user defined function in cobol
Reply with quote

Hi ,

I am using the below function in my program.

EXEC SQL
VALUES :WS-TIMESTAMP-OUT = FUNCTION JTIMEZONECONVERTER
(:WS-TIMESTAMP-IN ,
:WS-ORG-TIME-ZONE ,
:WS-TARGET-TIME-ZONE
)
END-EXEC

i am getting the error as

** External Compiler Module message
** DB0100 SQL0104N An unexpected token ":WS-TIMESTAMP-OUT =
** FUNCTION" was found following "VALUES ". Expected tokens may
** include: "<space>". SQLSTATE=42601


Thanks in advance
Naga
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 20, 2009 5:24 pm    Post subject:
Reply with quote

try: VALUES <function(parms)> INTO :Host-VAR
Back to top
View user's profile Send private message
Naga Rajender.K

New User


Joined: 19 Dec 2008
Posts: 13
Location: Hyderabad

PostPosted: Tue Jul 21, 2009 12:40 pm    Post subject:
Reply with quote

Than q Dick for ur reply.
But i am getting the same error with yhe above syntax. Can we use SELECT with RETURN..




Thanks in advance
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 21, 2009 5:23 pm    Post subject:
Reply with quote

Quote:
EXEC SQL
VALUES :WS-TIMESTAMP-OUT = FUNCTION JTIMEZONECONVERTER
(:WS-TIMESTAMP-IN ,
:WS-ORG-TIME-ZONE ,
:WS-TARGET-TIME-ZONE
)
END-EXEC


If JTIMEZONECONVERTER is a DB2 function try this


Code:

EXEC SQL
SET :WS-TIMESTAMP-OUT = JTIMEZONECONVERTER(:WS-TIMESTAMP-IN, :WS-ORG-TIME-ZONE, :WS-TARGET-TIME-ZONE)
END-EXEC
Back to top
View user's profile Send private message
Naga Rajender.K

New User


Joined: 19 Dec 2008
Posts: 13
Location: Hyderabad

PostPosted: Tue Jul 21, 2009 5:42 pm    Post subject: db2 function in cobol
Reply with quote

Hi Craq.

I tried with this. But didnt work.

Actually we are working with cobol on AIX environment. How can we know that whether this particular db2 function is created correctly or not.

Can anybody provide sql to verify whether db2 function is created or not.



Thanks in advance
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1226
Location: Israel

PostPosted: Tue Jul 21, 2009 5:54 pm    Post subject: Re: db2 user defined function in cobol
Reply with quote

Naga Rajender.K wrote:
EXEC SQL
VALUES :WS-TIMESTAMP-OUT = FUNCTION JTIMEZONECONVERTER
(:WS-TIMESTAMP-IN ,
:WS-ORG-TIME-ZONE ,
:WS-TARGET-TIME-ZONE
)
END-EXEC

What is that? is it part of a SELECT, an UPDATE or a SET statement?
You've removed too many details...

Also, what do you mean by this:
Naga Rajender.K wrote:
Can we use SELECT with RETURN
Back to top
View user's profile Send private message
Naga Rajender.K

New User


Joined: 19 Dec 2008
Posts: 13
Location: Hyderabad

PostPosted: Tue Jul 21, 2009 6:05 pm    Post subject: Sql to verify whether the DB2 Function is created or not
Reply with quote

can any one provide the sql query to verify whether the DB2 External Function is created or not.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 21, 2009 6:35 pm    Post subject:
Reply with quote

E.13 Retrieving catalog information about user-defined functions and stored procedures
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 21, 2009 7:06 pm    Post subject:
Reply with quote

You could try showing us the definition of the function!
Back to top
View user's profile Send private message
Naga Rajender.K

New User


Joined: 19 Dec 2008
Posts: 13
Location: Hyderabad

PostPosted: Tue Jul 21, 2009 8:03 pm    Post subject: Sql to verify whether the DB2 Function is created or not
Reply with quote

Actually I have the create query as follows.Im trying to derive the values from the below DDL.

CREATE FUNCTION TIMEZONECON(UTCtimestamp varchar(50), originaltimezone varchar(5), targetimezone varchar(5))
RETURNS varchar(100)
EXTERNAL NAME 'TIMEZONECON.TZCON’
LANGUAGE java
PARAMETER STYLE JAVA
DETERMINISTIC
FENCED
NOT NULL CALL
NO SQL
NO EXTERNAL ACTION
NO SCRATCHPAD
ALLOW PARALLEL;

Thanks
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 21, 2009 8:08 pm    Post subject:
Reply with quote

What are the definitions for WS-TIMESTAMP-IN, WS-ORG-TIME-ZONE, WS-TARGET-TIME-ZONE, and WS-TIMESTAMP-OUT?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Tue Jul 21, 2009 8:09 pm    Post subject: Reply to: db2 user defined function in cobol
Reply with quote

just take a decision.. You posted in the cobol forum, but You say..

Quote:

Actually we are working with cobol on AIX environment.
...
Actually I have the create query as follows.Im trying to derive the values from the below DDL.
...
LANGUAGE java
PARAMETER STYLE JAVA
...


what is that You want ?? icon_evil.gif

anywhere ( MF, AIX, UNIX, LINUX, WINDOZE ) any cobol thingy must be compiled,
why not speak to Your support
and read the manual for Your environment
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts User Cancels the job PANDU1 DB2 1 Sat Mar 04, 2017 8:21 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us