ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » eSQL Function with a parameter that is another function

Post new topic  Reply to topic
 eSQL Function with a parameter that is another function « View previous topic :: View next topic » 
Author Message
bradhack
PostPosted: Wed Sep 01, 2004 10:17 am    Post subject: eSQL Function with a parameter that is another function Reply with quote

Newbie

Joined: 28 May 2002
Posts: 7

I don't even know if this is possible (I just assumed that it was), but I'm having trouble calling a reusable eSQL function when one of my parameters is created by another function. Here's the deal:

CREATE FUNCTION fEntAtt(cCode CHAR, cValue CHAR) RETURNS CHAR
--Uses 2 arguements, Code and Value, to generate a sequence of 3 fields: Length, EntAttCode, & Value
BEGIN
DECLARE cEntAttString CHAR;
SET Environment.LastSuccessfulEntAttCode = cCode;
IF LENGTH(cValue) > 0 THEN
SET cEntAttString = RIGHT('0000' || CAST(LENGTH(cValue) + 10 AS CHAR),4) || cCode || cValue;
ELSE
SET cEntAttString = '';
END IF;
RETURN cEntAttString;
END;

This works fine when my input parameters are obtained from my XML input however, when I need to perform other formatting on the parameter field first, the function deosn't return anything.

Here's are two sample calls, the first works the second doesn't:

1. Set Environment.EntAtt = fEntAtt('010654',iAnnuity.SurrenderValue);

2. Set Environment.EntAtt = fEntAtt('020003',fParticipantRole(Environment.Annuitant.RoleCode));

The second function is as follows:
CREATE FUNCTION fParticipantRole(cRole CHAR) RETURNS CHAR
--Converts Participant Role to user-friendly text
BEGIN
DECLARE cRoleOut CHAR;
SET cRoleOut =
CASE cRole
WHEN '7' THEN 'Primary Beneficiary'
WHEN '18' THEN 'Owner'
WHEN '27' THEN 'Annuitant'
END;
RETURN cRoleOut;
END;

It works on its own, but when it's called as a parameter, the 1st function will not work.

As a workaround, I've set a variable to the results of the second function, and used that as input to the first. However, I'd like to be able to combine the two steps, if anyone knows how.

Thanks for your help.
Back to top
View user's profile Send private message
contactop
PostPosted: Wed Sep 01, 2004 12:49 pm    Post subject: Reply with quote

Acolyte

Joined: 26 Jun 2003
Posts: 50

Why dont u write a procedure, and get the variable as parameter of the function.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Sep 01, 2004 2:36 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I would expect this would work, looking at it.

But, what version are you running?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Sep 01, 2004 11:56 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

This is a known defect. It should indeed work exactly as you say. However the fix is is not yet available in a CSD. If you raise a PMR you should be able to get one...

To respond to contactop, the same problem would occur if you used a procedure with a function return value as a parameter as well, due to the nature of the problem. The same fix will cover both scenarios.

Your workaround (assign function return to a local variable - two steps rather than one step) is the correct one.


Cheers,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » eSQL Function with a parameter that is another function
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.