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 » EVAL failing

Post new topic  Reply to topic
 EVAL failing « View previous topic :: View next topic » 
Author Message
klabran
PostPosted: Tue Feb 24, 2004 2:03 pm    Post subject: EVAL failing Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

I need to convert an incoming field from #'s to Alpha's
1->A, 2->B, 3->C, ECT....
I am getting an error on the Eval line....
"Expected ')'
Where am I missing a parantheses?

DECLARE C INTEGER;
DECLARE D INTEGER;
DECLARE ALPHA CHARACTER;

SET C = 1;
SET D = (SELECT COUNT(*) FROM InputBody."CITATIONS"."CITATION"[I]."CHARGES"."CHARGE"[] AS CHGNUM)
SET ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
WHILE C <= D DO
SET "OutputRoot"."XML"."CITATION"."CHARGES"."CHARGE"[C]."CHRGSEQ" = EVAL('SUBSTRING(ALPHA FROM ' || CAST(C AS CHAR) || ' TO ' || CAST(C AS CHAR) || ')');
SET C = C + 1;
END WHILE;

Thanks,

Kevin
Back to top
View user's profile Send private message Visit poster's website
klabran
PostPosted: Tue Feb 24, 2004 2:21 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Nevermind.... Again....I need more coffee. Didn't notice that I had TO instead of FOR in the Substring Syntax.

EVAL('SUBSTRING(ALPHA FROM ' || CAST(C AS CHAR) || ' TO ' || CAST(C AS CHAR) || ')');

My VB Loop syntax is to blame on that one.
Back to top
View user's profile Send private message Visit poster's website
JT
PostPosted: Tue Feb 24, 2004 2:21 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Forgot ';' at end of:
SET D = (SELECT COUNT(*) FROM InputBody."CITATIONS"."CITATION"[I]."CHARGES"."CHARGE"[] AS CHGNUM)
Back to top
View user's profile Send private message
klabran
PostPosted: Tue Feb 24, 2004 2:23 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

JT,

Thx for catching that!

Thanks
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Feb 24, 2004 2:56 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You might also be able to do away with using Eval for this, as well, which would give you a speed increase.

You might be able to rework things so that you can use the {VariableName} syntax instead.

Also, you might want to think again if you want to be using the Substring the way you are. What I see your code doing is this: {substring from 1 for 1, substring from 2 for 2, ... , substring from 26 for 26}.

That may not be what you want it to do.

You might want to do something like this
Code:
set Environment.Variables.Alpha = list( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M' ,'N' ,'O' ,'P', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
while C<=D do
set OuputRoot.XML.CITATION.CHARGES.CHARGE[c].CHRGSEQ=Environment.Variables.Alpha[C];

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klabran
PostPosted: Tue Feb 24, 2004 4:08 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Jeff,

I caught that Substring bug soon after my post.

Seeing how the list implementation is faster, I'll probably use it instead, once I work out all the features needed in this flow.

Thanks!

Kevin
Back to top
View user's profile Send private message Visit poster's website
klabran
PostPosted: Tue Feb 24, 2004 4:13 pm    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Quote:
you might be able to rework things so that you can use the {VariableName} syntax instead.


Jeff,

Forgive me for my ignorance but what do you mean?

Also the list seems to be failing for me...

The below is in a loop with CHRG being set to the Charge Seq # in the incoming XML message.
****************************
SET CHRG = CAST(InputBody."CITATIONS"."CITATION"[I]."CHARGES"."CHARGE"[C]."CHRGSEQ" AS CHAR);
SET "OutputRoot"."XML"."CITATION"."CHARGES"."CHARGE"[C]."CHRGSEQ" = Environment.Variables.ALPHA[CHRG];
**********************************
I get the following error when trying to deploy:

Cannot assign a list to a non-list, nor a non-list to a list.
A list of values cannot be assigned to a scalar variable or single message field, nor can a scalar value be assigned to a list.

What am I missing?

Kevin
Back to top
View user's profile Send private message Visit poster's website
Missam
PostPosted: Tue Feb 24, 2004 6:17 pm    Post subject: Reply with quote

Chevalier

Joined: 16 Oct 2003
Posts: 424

Code:

****************************
SET CHRG = CAST(InputBody."CITATIONS"."CITATION"[I]."CHARGES"."CHARGE"[C]."CHRGSEQ" AS CHAR);
SET "OutputRoot"."XML"."CITATION"."CHARGES"."CHARGE"[C]."CHRGSEQ" = Environment.Variables.ALPHA[CHRG];
**********************************


1)In your frist line you are assigning a Char Value to an index
2)In the second line "CHRGSEQ" This is a non List and you are assigning to ALPHA[CHRG] This is a list.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Feb 24, 2004 7:53 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Well, I must confess I didn't take the time to actually test the code I posted.

I should really start doing that more.



This should hopefully resolve your list/scalar issues..
Code:
set Environment.Variables.Alpha[] = LIST{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M' ,'N' ,'O' ,'P', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};


The {VariableName} syntax works like this
Code:
Set Environment.Variables.WhichElement = 'ElementA';
Set Environment.Variables.ElementA = 1;
Set Environment.Variables.ElementB = 2;
Set Environment.Variables.ElementC = 3;
Set Environment.Variables.Output = Environment.Variables.{Environment.Variables.WhichElement};


Again, I haven't tested this, but the syntax should cause Environment.Variables.Output to be equal to 1. It allows for the contents of a variable to be interpreted into a field name.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klabran
PostPosted: Wed Feb 25, 2004 6:47 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Again, Thanks everyone for helping me in a crash course on MQSI/ESQL.


Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » EVAL failing
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.