Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
PROBLEM WITH EXTERNAL UDF

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
perez_a

New User


Joined: 02 Feb 2006
Posts: 25
Location: Italy

PostPosted: Tue Jun 06, 2006 4:24 pm    Post subject: PROBLEM WITH EXTERNAL UDF
Reply with quote

HELLO FRIENDS,
I'M CREATING AN EXTERNAL UDF WITH HOST LANGUAGE COBOL.
I NEED TO RETURN ONLY 1 PARAMETER TO THE UDF, HOW CAN I DO?
I'VE FOUND THIS EXAMPLE:

WORKING-STORAGE SECTION.
77 EXCHANGE_RATE PIC S9(5)V9(5) PACKED-DECIMAL.
LINKAGE SECTION.
* PARAMETERS *
77 ORIGINAL_CURRENCY PIC XXX.
77 TARGET_CURRENCY PIC XXX.
77 EXCHANGE_DATE FORMAT DATE.
PROCEDURE DIVISION USING
BY REFERENCE ORIGINAL_CURRENCY
BY REFERENCE TARGET_CURRENCY
BY REFERENCE EXCHANGE_DATE
RETURNING EXCHANGE_RATE.
BUT THE STATEMENT "RETURNING" IS NOT ALLOWED.
PLEASE HELP ME!!! icon_cry.gif
BIE BIE ALEX
Back to top
View user's profile Send private message

anamikak

New User


Joined: 10 May 2006
Posts: 64
Location: Singapore

PostPosted: Wed Jun 07, 2006 11:12 am    Post subject:
Reply with quote

Specifying "RETURN" for UDF , that too in Procedure division is not allowed in COBOL. Always, you have only PROCEDURE DIVISION using parm1,parm2(ie, list of parameters).

Also before you start of writing external UDF, you have to define the UDF to DB2. This is done by using
CREATE FUNCTION function name(parmetr declaration with data type)
Returns (data type1, data type2...)
Parameter style SQL
Language COBOL;

so you see , The return statement is coded while defining the UDF and not in the external function that is written in host language, in this case it is COBOL.


after this, when you actually write the UDF in Cobol, you can declare the input and out partmeters in the Linkage section at 01 levels and in the the procedure division you can say "USING " pameters defined in linkage section.

hope this helps you.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us