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 » date subtraction

Post new topic  Reply to topic Goto page 1, 2  Next
 date subtraction « View previous topic :: View next topic » 
Author Message
bindu
PostPosted: Mon Oct 25, 2004 4:28 pm    Post subject: date subtraction Reply with quote

Voyager

Joined: 07 May 2004
Posts: 97

Hi,
I want to subtract n number of days from the current date

DECLARE DT DATE;
DECLARE n INTEGER;
SET n=10;
SET OutputRoot.XML."xml"."date"= CURRENT_DATE - INTERVAL n DAY;

then i am getting errors. Any suggestions.

Thanx,
Bindu.
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Oct 25, 2004 4:58 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

What is the exact error message you are getting?

Have you tried putting constant there? For example,

SET OutputRoot.XML."xml"."date"= CURRENT_DATE - INTERVAL '10' DAY;
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
RocknRambo
PostPosted: Mon Oct 25, 2004 4:59 pm    Post subject: Reply with quote

Partisan

Joined: 24 Sep 2003
Posts: 355

wat error ur getting...??

in ur ESQL code
Code:
SET n=10;

i see there z no single quotes (probably a typo)..


and if ur n of days is constant and try this..

SET OutputRoot.XML."xml"."date"= CURRENT_DATE - INTERVAL '10' DAY;



-RR
Back to top
View user's profile Send private message
RocknRambo
PostPosted: Mon Oct 25, 2004 5:02 pm    Post subject: Reply with quote

Partisan

Joined: 24 Sep 2003
Posts: 355

oops!...if I see the timestamp... looks like it was coincidence tht me & kirani..had hit the submit in few seconds gap....


Sorry for repeatable answers

-RR
Back to top
View user's profile Send private message
bindu
PostPosted: Mon Oct 25, 2004 5:05 pm    Post subject: date subtraction urgent Reply with quote

Voyager

Joined: 07 May 2004
Posts: 97

Hi,
Thanx for ur replies. But here N is not constant so its a varible. Any suggestions.

Thanx ,
Bindu
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Oct 25, 2004 5:07 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

In your PM you mentioned that you get "syntax error". Can you provide your environment details?
I'd suggest that you try deploying your message flow even if it says syntax error.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
bindu
PostPosted: Mon Oct 25, 2004 5:12 pm    Post subject: date subtraction urgent Reply with quote

Voyager

Joined: 07 May 2004
Posts: 97

Hi ,
SET OutputRoot.XML."xml"."Low"= CURRENT_DATE - INTERVAL lo DAY ;

LO is INTEGER data type.

BIP2403E: (61, 44) : An interval qualifier is not allowed here.

An interval qualifier was specified after a pair of parentheses which did not contain a subtraction expression.

Correct the syntax of your expression and redeploy the message flow.

Thanq You,
Bindu.
Back to top
View user's profile Send private message
JT
PostPosted: Mon Oct 25, 2004 5:14 pm    Post subject: Reply with quote

Padawan

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

Code:
DECLARE n CHARACTER;
SET n= '10';

It appears the INTERVAL parameter is a string, not an integer. Click here for details.
Back to top
View user's profile Send private message
bindu
PostPosted: Mon Oct 25, 2004 5:24 pm    Post subject: date subtraction urgent Reply with quote

Voyager

Joined: 07 May 2004
Posts: 97

hI ,

If i set n as character then i am getting the follwoing error on LOG

BIP2402E: (60, 57) : Syntax error : 'integer lo'.

The token caused a syntax error.

Correct the syntax of your expression and redeploy the message flow.

any suggestions,

Thanx,
Bindu.
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Oct 25, 2004 5:26 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Well, in that case try using EVAL statement.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
bindu
PostPosted: Mon Oct 25, 2004 6:37 pm    Post subject: date subtraction Reply with quote

Voyager

Joined: 07 May 2004
Posts: 97

Hi kiran,
can you tell me how can i use EVAL for this. Thanx for ur help.

Thanx,
Bindu.
Back to top
View user's profile Send private message
JT
PostPosted: Mon Oct 25, 2004 7:18 pm    Post subject: Reply with quote

Padawan

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

Quote:
BIP2402E: (60, 57) : Syntax error : 'integer lo'.

The token caused a syntax error.

Correct the syntax of your expression and redeploy the message flow.

Can you post your latest ESQL code?
Back to top
View user's profile Send private message
bindu
PostPosted: Mon Oct 25, 2004 7:38 pm    Post subject: date subtraction Reply with quote

Voyager

Joined: 07 May 2004
Posts: 97

Hi,
Actuvally i am looking for recent date among four dates(yyyy-mm-dd) so any suggestions for this.

Thanx,
Madhu
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Oct 25, 2004 10:46 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

You can store your dates into Environment Variable and then use MAX (or MIN) function to find most recent/old date. For example,
Code:

      DECLARE D1 DATE CURRENT_DATE;
      DECLARE D2 DATE CURRENT_DATE;
      DECLARE D3 DATE;
      DECLARE D4 DATE;
      SET D3 = D1 + INTERVAL '10' DAY;
      SET D4 = D2 + INTERVAL '20' DAY;
      
      SET Environment.Variables.Dt[1] = D1;
      SET Environment.Variables.Dt[2] = D4;
      SET Environment.Variables.Dt[3] = D2;
      SET Environment.Variables.Dt[4] = D3;
      
      SET OutputRoot.XML.MyData.MaxDate = THE (SELECT  MAX(t) from Environment.Variables.Dt[] as t);


This will return highest date.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
kirani
PostPosted: Mon Oct 25, 2004 10:53 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

oh... and you can use EVAL function like this,
Code:

      DECLARE DY CHAR;
      SET DY = '10';
      SET D3 = D1 + EVAL('INTERVAL '''|| DY || ''' DAY');

_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

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

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