Author |
Message
|
Seb |
Posted: Thu Aug 27, 2009 5:16 am Post subject: MQMD/Expiry --> WMB converts Integer to DateTime |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Hi,
this is the first time I am recognising that the MQMD Expiry Integer value gets automatically converted to a DateTime value within WMB.
I wrote an Audit Flow that writes certain information (incl. the Expiry) to a DB. The DB column is defined as an Integer.
Most messages that are transferred have an Expiry of -1 which is not converted, but all positive values are.
Thus, I am asking if this is documented anywhere? And is there a way to bypass that feature?
Cheers,
Seb |
|
Back to top |
|
 |
zpat |
Posted: Thu Aug 27, 2009 5:37 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
I seem to recall something in the WMB Info Center about this. |
|
Back to top |
|
 |
jbanoop |
Posted: Thu Aug 27, 2009 6:27 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
you can use INTERVAL to add a fixed amount of time to the Expiry.
Code: |
Eg: SET OutputRoot.MQMD.Expiry=CURRENT_GMTTIMESTAMP + INTERVAL '900' SECOND; |
Hope it helps |
|
Back to top |
|
 |
Seb |
Posted: Thu Aug 27, 2009 6:39 am Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Well the question was not how to set the Expiry.
My (sub)flow takes certain information and writes them to a DB. The bad thing is that the Expiry field in the message tree can be of type Integer (if the message was sent with -1) or of type Timestamp (if the message was sent with a positive Integer or a dedeciated date).
The Infocenter tells about the sepcifics of the Expiry field as it can take different datatypes.
My problem is, and the InfoCenter seems not to have information about it, that even an positive Integer is converted to a Timestamp value in the Broker's messages tree.
BTW: Is there a function to return the data type not the field type of a certain field. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Aug 27, 2009 7:31 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
AFAIK, the MQMD Expiry is a LONG Integer. I'd be very surprised if it changed datatype if the value is not -1. The MQMD (for a given MQMD Version) is a FIXED length data structure.
I'm using the file cmqc.h as my reference
It is located in the WMQ_INSTALLDIR/tools/c/include/ directory _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Seb |
Posted: Thu Aug 27, 2009 7:42 am Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ad09700_.htm
...
Note:
1. The Expiry field in the MQMD is a special case:
* An INTEGER value represents an expiry interval in tenths of a second. If the Expiry field is set to -1, it represents an unlimited expiry interval (that is, the message never expires) If the Expiry field is a positive INTEGER, it represents an expiry interval of that number of tenths of a second (for example, if it is set to 4, it represents 4 tenths of a second, if it is set to 15, it represents one and a half seconds).
* A GMTTIMESTAMP value represents a specific expiration time.
If Expiry contains a GMTTIMESTAMP in the past, or an INTEGER of less than 1 (excluding -1), it is set to the value 1 (one tenth of a second, the minimum value). |
|
Back to top |
|
 |
Luke |
Posted: Thu Aug 27, 2009 7:45 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
I'm not sure if you can control this and force it to be parsed as an integer rather than a TIMESTAMP.
But, I guess you could calculate the integer from the GMTTIMESTAMP -
Calculate GMTTIMESTAMP - CURRENT_GMTTIMESTAMP as an interval, cast to an integer and mulitply by 10? |
|
Back to top |
|
 |
Seb |
Posted: Thu Aug 27, 2009 7:53 am Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Hi Luke,
that is what I do at the moment. In addition, I have to test if the Expiry field contains a Timestamp or an Integer value - as -1 is not converted.
Anyway, I don't like this solution, but it seems to be the best practice in that case.
Thanks! |
|
Back to top |
|
 |
Luke |
Posted: Thu Aug 27, 2009 7:59 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
Hi Seb,
Quote: |
I don't like this solution |
We agree on that too then, seems like a bit of a faff really
Quote: |
seems to be the best practice |
Maybe not, there might be someone wiser come along and tell us we don't need to do that ... anyone? |
|
Back to top |
|
 |
|