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 » Current timestamp issue in while loop

Post new topic  Reply to topic
 Current timestamp issue in while loop « View previous topic :: View next topic » 
Author Message
mahesh4eai
PostPosted: Thu Sep 11, 2014 10:47 am    Post subject: Current timestamp issue in while loop Reply with quote

Novice

Joined: 09 Aug 2014
Posts: 21

I am using the Current timestamp in while loop like this:

Esql code:

WHILE (i <= Count) DO

DECLARE Cust_id,Strdate,Strfilename CHARACTER;

SET Strdate = CAST(CURRENT_TIMESTAMP AS CHARACTER FORMAT 'YYYYMMDDhhmmss');

IF (CONTAINS(InputRoot.DFDL.OrderAck.Record[i],'*01')) THEN
SET Cust_id = SUBSTRING(InputRoot.DFDL.OrderAck.Record[i] FROM 4 FOR 4);
SET Strfilename = 'MarketName' || Cust_id || Strdate || '.dat';
SET OutputLocalEnvironment.WrittenDestination.File.Name = Strfilename;
END IF;

SET OutputRoot.DFDL.OrderAck.Record[j] = InputRoot.DFDL.OrderAck.Record[i];
IF(CONTAINS(InputRoot.DFDL.OrderAck.Record[i],'*200')) THEN
SET j = 0;
PROPAGATE TO TERMINAL 'out';
END IF;

SET i = i + 1;
SET j = j + 1;

END WHILE;


But when the records propagated to out terminal one by one and every record have the same timestamp.
Example :Strdate for 1st record is 201409254114604.dat and Strdate for second record also same.
I am expecting different current timestamp values when loop is repeating.Can you please help me for how to resolve this issue?


Last edited by mahesh4eai on Thu Sep 11, 2014 10:51 am; edited 1 time in total
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Sep 11, 2014 10:50 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

This is just how CURRENT_TIMESTAMP works.

Also, you should change your code to use REFERENCEs instead of using [i].

It will perform *much* faster.
Back to top
View user's profile Send private message
mahesh4eai
PostPosted: Thu Sep 11, 2014 10:56 am    Post subject: Reply with quote

Novice

Joined: 09 Aug 2014
Posts: 21

Thanks

Last edited by mahesh4eai on Fri Sep 12, 2014 2:34 am; edited 2 times in total
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 11, 2014 10:59 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mahesh4eai wrote:
i am debugging the flow in slowly,but Strdate value are not changed in 2nd and 3 rd records..


No, it won't. As my most worthy associate points out, this is how CURRENT_TIMESTAMP works:

Quote:
All calls to CURRENT_TIMESTAMP within the processing of one node are guaranteed to return the same value.

_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 11, 2014 11:03 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

My most worthy associate is also right about using references not indexes.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Sep 11, 2014 11:41 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

If you are using java you could get the system date....
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Thu Sep 11, 2014 11:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
If you are using java you could get the system date....


Or the OP could read what I told him in his previous post and use ESQL.

Empowered by choice.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Current timestamp issue in while loop
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.