|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Subtraction computation |
« View previous topic :: View next topic » |
Author |
Message
|
ekurzum |
Posted: Wed Sep 24, 2003 7:39 am Post subject: Subtraction computation |
|
|
 Newbie
Joined: 24 Sep 2003 Posts: 2 Location: United States
|
In a Compute Node I have declared a field as character field parsed the necessary data and concatinated the new data in the declared field. I converted to integer for a subtraction computation. Usertrace came back with an error 'Ensure that the data types passed to this operator are compatible'. Here is some cuts from the code.
Declare Put_Date_Time CHAR
Declare Expiry_Time CHAR
SET Expiry_Time = HH||MI||SS||MS||DD||MM||CCYY;
SET Put_Date_Time = HS||M||S||ME||DA||MO||YR;
SET Expiry_Time = CAST(Expiry_Time AS INT);
SET Put_Date_Time = CAST(Put_Date_Time AS INT);
SET TSTAMP = Expiry_Time - Put_Date_Time
 |
|
Back to top |
|
 |
EddieA |
Posted: Wed Sep 24, 2003 8:43 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
You have 2 statements that both try and set Put_Date_Time and Expiry_Time. First:
Code: |
SET Expiry_Time = HH||MI||SS||MS||DD||MM||CCYY;
SET Put_Date_Time = HS||M||S||ME||DA||MO||YR; |
Which I'm assuming is in character format. Then you try:
Code: |
SET Expiry_Time = CAST(Expiry_Time AS INT);
SET Put_Date_Time = CAST(Put_Date_Time AS INT); |
Which tries to use the same variables, which were decalred as CHAR as INTs.
Also, even if you sort out your data types, this method of obtaining a difference between 2 times just won't work. Use the TIMESTAMP variables instead.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
ndgohel |
Posted: Thu Sep 25, 2003 6:39 am Post subject: declaration error |
|
|
 Newbie
Joined: 04 Oct 2002 Posts: 2
|
dear,
you have declared both variable as type CHAR.
after casting to INT you are assigning the same to an CHAR variable.
what I suggest, declare other two variables as INT and do something like :
SET Expiry_Time = HH||MI||SS||MS||DD||MM||CCYY;
SET Put_Date_Time = HS||M||S||ME||DA||MO||YR;
DECLARE int_Expiry_Time INTEGER;
DECLARE int_Put_Date_Time INTEGER;
SET int_Expiry_Time = CAST(Expiry_Time AS INT);
SET int_Put_Date_Time = CAST(Put_Date_Time AS INT);
This code will work.
Regards,
Nilesh D. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|