Author |
Message
|
marco |
Posted: Fri Dec 15, 2006 2:19 am Post subject: Problem setting date and time |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Hi,
I've created a messageflow to receive input through the HTTP-input node and put the data on an MQSeries Queue.
The problem is that the date and the time of every message (in the MQMD) is that of the last deploy from the messageflow.
I tried setting time and date in different ways (even hardcoding, just to check) but nothing helps. The confusing part is that the setting of for example the application name works perfectly ...
...
SET OutputRoot.MQMD.PutApplName = 'plain_http_adapter';
SET OutputRoot.MQMD.PutApplType = 11;
SET OutputRoot.MQMD.PutDate = CURRENT_DATE;--'20061210'
SET OutputRoot.MQMD.PutTime = CURRENT_TIME;
...
Any help would be appreciated ...
T
PS I'm currently working on a v5 broker |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Dec 15, 2006 3:39 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Have you tried using character variables for date and time and using the GMT version (MQ dates are always in GMT) then assigning the date to the variable (make sure the format will match) and finally assigning the variable to the MQMD field?
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
marco |
Posted: Fri Dec 15, 2006 4:08 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
I've tried setting it hard-coded ... that should always work ... no ? |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Dec 15, 2006 4:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Maybe you should tell us what version and fix pack level you're using. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
marco |
Posted: Fri Dec 15, 2006 6:00 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Sorry :
Version 5 broker, Release 0.1 Update 4 |
|
Back to top |
|
 |
EddieA |
Posted: Mon Dec 18, 2006 10:34 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
The MQMD fields for date and time are MQCHAR8. The character representation of CURRENT_DATE and CURRENT_TIME contain "additional" characters.
You need to either SUBSTRING out the relevent information, or use FORMAT. (Was FORMAT available in V5 ??)
Cheers. _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
JosephGramig |
Posted: Mon Dec 18, 2006 12:59 pm Post subject: |
|
|
 Grand Master
Joined: 09 Feb 2006 Posts: 1244 Location: Gold Coast of Florida, USA
|
And the format syntax is something like:
Code: |
SET szTest = CAST(CURRENT_DATE AS CHARACTER FORMAT 'dd/MM/yy'); |
And it is not available in WBIMB 5.0. _________________ Joseph
Administrator - IBM WebSphere MQ (WMQ) V6.0, IBM WebSphere Message Broker (WMB) V6.1 & V6.0
Solution Designer - WMQ V6.0
Solution Developer - WMB V6.1 & V6.0, WMQ V5.3 |
|
Back to top |
|
 |
marco |
Posted: Wed Dec 20, 2006 1:06 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Thanx for the replies ...
I've tried both :
SET OutputRoot.MQMD.PutDate = '19/12/06'
SET OutputRoot.MQMD.PutDate = '20061219'
None of them works ...
I'm really lost here, this will be something stupid, but I can't find it
T |
|
Back to top |
|
 |
EddieA |
Posted: Wed Dec 20, 2006 11:34 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
What do you have for the Message Context, in the MQOutput node. Try using one of the SET options.
Cheers. _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
marco |
Posted: Wed Dec 20, 2006 11:40 pm Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Let me give some more information :
This is the ESQL I'm running :
DECLARE d CHAR CAST(CURRENT_DATE AS CHAR); -- YYYY-MM-DD "DATE '2006-12-14'"
DECLARE t CHAR CAST(CURRENT_TIME AS CHAR); -- HH:MM:SS.mmm "TIME '15:41:00.515'"
SET OutputRoot.MQMD.StrucId = MQMD_STRUC_ID;
SET OutputRoot.MQMD.ApplIdentityData = '';
SET OutputRoot.MQMD.ApplOriginData = '';
SET OutputRoot.MQMD.Expiry = -1;
SET OutputRoot.MQMD.Encoding = InputRoot.Properties.CodedCharSetId;
SET OutputRoot.MQMD.PutApplName = 'plain_http_adapter';
SET OutputRoot.MQMD.PutApplType = 11;
SET OutputRoot.MQMD.PutDate = '20050311';--SUBSTRING(d FROM 7 for 4)||SUBSTRING(d FROM 12 for 2)||SUBSTRING(d FROM 15 for 2);
SET OutputRoot.MQMD.PutTime = SUBSTRING(t FROM 7 for 2)||SUBSTRING(t FROM 10 for 2)||SUBSTRING(t FROM 13 for 2)||SUBSTRING(t FROM 16 for 2);
SET OutputRoot.MQMD.UserIdentifier = 'testuser';
Just before the "return TRUE" is called in the compute node, the MQMD looks like this :
StrucId : MD
ApplIdentityData : ' '
ApplOriginData : ' '
Expiry : -1
Encoding : 1208
PutApplName : plain_http_adapter
PutApplType : 11
PutDate : 20050311
PutTime : 08264970
UserIdentifier : testuser
looks the way I would like it ...
when stepping out of the compute node the MQMD becomes :
StrucId : MD
ApplOriginData : ' '
Expiry : -1
Encoding : 546
PutApplName : plain_http_adapter
PutApplType : 11
PutDate : 2006-12-21
PutTime : 07:25:43.624
UserIdentifier : testuser
Format : ' '
CodedcharsetId : 1208
Transactoinal : false
persistence : 0
Priority : 0
CorrelID : 000000000000000000000000000000000000000000000000
So here some field are overridden ...
My compute node has mode "All", the outputnode has "set all" configured, but the data is already wrong there ...
T
PS I'v tried setting the date with '2005-03-11', but same results occur |
|
Back to top |
|
 |
EddieA |
Posted: Thu Dec 21, 2006 10:16 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Insert this
Code: |
CREATE NEXTSIBLING OF OutputRoot.Properties domain 'MQMD'; |
before
Code: |
SET OutputRoot.MQMD.StrucId = MQMD_STRUC_ID; |
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Dec 21, 2006 2:39 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
And I don't believe that MQMD takes any decimals on the time field.... _________________ MQ & Broker admin |
|
Back to top |
|
 |
marco |
Posted: Tue Jan 02, 2007 2:05 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Thanx for the suggestions, I've just tried them, but it failed.
This is the complete module code :
CREATE COMPUTE MODULE Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE type CHAR;
SET type = FIELDNAME(InputRoot.XML.[<]);
SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueName =
TRIM(THE(Select ITEM A.QNAME from Database.DB2ADMIN.ROUTING AS A
where A.IDOC_TYPE = type));
SET OutputRoot.Properties = InputRoot.Properties;
CALL CreateMQMD();
SET OutputRoot.XML = InputRoot.XML;
RETURN TRUE;
END;
CREATE PROCEDURE CreateMQMD() BEGIN
DECLARE d CHAR CAST(CURRENT_DATE AS CHAR); -- YYYY-MM-DD "DATE '2006-12-14'"
DECLARE t CHAR CAST(CURRENT_TIME AS CHAR); -- HH:MM:SS.mmm "TIME '15:41:00.515'"
CREATE NEXTSIBLING OF OutputRoot.Properties domain 'MQMD';
SET OutputRoot.MQMD.StrucId = MQMD_STRUC_ID;
SET OutputRoot.MQMD.ApplIdentityData = '';
SET OutputRoot.MQMD.ApplOriginData = '';
SET OutputRoot.MQMD.Expiry = -1;
SET OutputRoot.MQMD.Encoding = InputRoot.Properties.CodedCharSetId;
SET OutputRoot.MQMD.PutApplName = 'plain_http_adapter';
SET OutputRoot.MQMD.PutApplType = 11;
SET OutputRoot.MQMD.PutDate = '2005-03-11';--SUBSTRING(d FROM 7 for 4)||SUBSTRING(d FROM 12 for 2)||SUBSTRING(d FROM 15 for 2);--
SET OutputRoot.MQMD.PutTime = SUBSTRING(t FROM 7 for 2)||SUBSTRING(t FROM 10 for 2)||SUBSTRING(t FROM 13 for 2)||SUBSTRING(t FROM 16 for 2);
SET OutputRoot.MQMD.UserIdentifier = 'testuser';
/*SET OutputRoot.MQMD.Report = 0;
SET OutputRoot.MQMD.Persistence = 2;
SET OutputRoot.MQMD.Priority = -1;
SET OutputRoot.MQMD.Offset = 0;
SET OutputRoot.MQMD.ReplyToQ = ' ';
SET OutputRoot.MQMD.ReplyToQMgr = ' ';
SET OutputRoot.MQMD.MsgType = 8;
SET OutputRoot.MQMD.MsgSeqNumber = 1;
SET OutputRoot.MQMD.MsgFlags = 0;
SET OutputRoot.MQMD.CodedCharSetId = 0;
SET OutputRoot.MQMD.BackoutCount = 0;
SET OutputRoot.MQMD.Version = 1;
SET OutputRoot.MQMD.Transactional = true;
SET OutputRoot.MQMD.SourceQueue = 'WebService';*/
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE; |
|
Back to top |
|
 |
special_agent_Queue |
Posted: Tue Jan 02, 2007 6:04 am Post subject: |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
The PutTime needs to be in a TIMESTAMP format. If you need the time in a different format, add it to the message somewhere, the rfh2 usr folder, or just have the receiving application handle it. |
|
Back to top |
|
 |
marco |
Posted: Tue Jan 02, 2007 6:14 am Post subject: |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
I've tried with the CURRENT_TIME function, without luck.
I'm afraid I will have to put the time and date in the data somewhere ... but I'm still finding it very strange it wont work |
|
Back to top |
|
 |
|