Author |
Message
|
Testo |
Posted: Wed Jul 28, 2004 10:49 am Post subject: INTEGER elements length in CWF |
|
|
 Centurion
Joined: 26 Feb 2003 Posts: 120 Location: Italy - Milan
|
I know I'm going to post a fancy question but I've tried to find the solution with the Search in this forum and through WMQI 2.1 manuals without success.
I have to define a CWF message set, I have some INTEGER elements that have a specific number of digits, let's say 5. If I choose INTEGER, I can specify the length only in terms of bytes and not in terms of digits. What should I do? Define them as DECIMAL with 0 decimals? Or should I define them as STRING and then eventually cast them as INTEGER when manipulating them with ESQL? In this last scenario, I would loose the ability of the parser to check if they are really numbers instead of generic strings...
Thanks in advance for any help,
Cheers
Andrea Tedone
IBM IT Specialist |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jul 28, 2004 11:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Add them as Integer types, with a sufficient byte size to cover the needed number of digits.
Then set a maximum value constraint.
So, if you had a three digit integer, if you set the maximum value constraint to 999, that should enforce the digit length. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kirani |
Posted: Wed Jul 28, 2004 11:18 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Andrea,
What is your input data source? Is it C program (Integer data) or COBOL or something else? If you are using COBOL data type then you can define the field as Extended Decimal in Physical Type and set the length to 3 bytes.
I think the maximum value constraint are not enfored by the broker in WMQI 2.1, but I could be wrong. I remember reading something like this in manual. _________________ 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 |
|
 |
Testo |
Posted: Wed Jul 28, 2004 11:19 am Post subject: WOW |
|
|
 Centurion
Joined: 26 Feb 2003 Posts: 120 Location: Italy - Milan
|
Great trick Jeff!
Maybe in future releases it will be possible to do the opposite? I.e. to define the number of digits and setting implicitly the max value possible and the number of bytes needed for that max limit?
In any case, THANK YOU for your suggestion, I have been struggling with this issue also in the past and I can't believe it was so easy!!!
Cheers,
Andrea |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jul 28, 2004 11:21 am Post subject: Re: WOW |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Testo wrote: |
Great trick Jeff! |
Hope it works! _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Testo |
Posted: Wed Jul 28, 2004 11:32 am Post subject: Ups |
|
|
 Centurion
Joined: 26 Feb 2003 Posts: 120 Location: Italy - Milan
|
Kiran,
I read your message a bit late, just after posting my reply to Jeff.
Thinking at Jeff's trick, I think it does not solve completely my issue. I will use an example.
Let's say I have a 5 digits integer that MUST be a 5 digits element, eventually padded with '0' on the left (in fact it's a fixed length string for a COBOL com area).
If I define it as an Integer with 3 bytes and with the maximum value constraint set to 99999, what happens if I assign a number like '999' or '00999'? I don't think the former could be padded and I don't think the latter will keep the two '0' on the left....
What do you think?
I hope to be wrong but I'm not sure I can avoid the 'horrible' String simulation...
Cheers,
Andrea |
|
Back to top |
|
 |
EddieA |
Posted: Wed Jul 28, 2004 11:47 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Andrea. I think you need to be a little more specific in what you mean by Integer, because that will define (internally) how the data is held in terms of bytes vs. digits.
As you mentioned COBOL, I'll dig into me memory banks and try and remember the right terminology.
Are you talking about a PIC 9 COMP value. In which case this is a binary value and will be a half-word, full-word or double-word depending on how many '9's you define.
Or, are you thinking of a PIC 9, or PIC S9, type field.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Testo |
Posted: Wed Jul 28, 2004 12:07 pm Post subject: COBOL is not my domain... |
|
|
 Centurion
Joined: 26 Feb 2003 Posts: 120 Location: Italy - Milan
|
Eddie,
I don't know. I mean, I will have to put in these 5-digits elements just NUMBERS, that are related to financial deals (like an account number or something like that).
So, if I have to create a 5-digits number padded with '0' on the left, I would expect to define an INTEGER (because 5 numbers are in any case an integer) so that the parser can validate it. But this does not seem to be an easy task...
I don't know how the COBOL program will treat then this number... but my requirement, from the broker perspective, it's clear: is it possible to define a fixed-length element, treated as an integer, padded with '0' on the left?
I will perform some tests tomorrow (in Italy it's 10 PM now and I don't have a WMQI box with me right now) and I'll come back to you with my results...
Cheers and thanks for your feedbacks,
Andrea |
|
Back to top |
|
 |
kirani |
Posted: Wed Jul 28, 2004 1:17 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Andrea,
Depending on what your PIC clause is for that element you can set your Physical Format to any one of the following,
1. Extended Decimal for PIC 9. For example, PIC 999 or PIC 9(10).
2. Packed Decimal for COMP-3 data types. For example, PIC 9(3) COMP-3.
3. Integer for COMP,COMP-4, COMP-5 in COBOL. For example, PIC 9(4) COMP.
You can make use of Padding propert in MRM to pad your data with any char.
Is this the input or output data definition we are talking about? _________________ 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 |
|
 |
Testo |
Posted: Wed Jul 28, 2004 11:24 pm Post subject: OK.. |
|
|
 Centurion
Joined: 26 Feb 2003 Posts: 120 Location: Italy - Milan
|
It's a PIC 9, so it should be Extended Decimal, with padding set to '0' and 'right justify'.
Correct?
Cheers,
Andrea |
|
Back to top |
|
 |
kirani |
Posted: Thu Jul 29, 2004 8:16 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
You got it! _________________ 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 |
|
 |
|