Author |
Message
|
rasol |
Posted: Wed Aug 16, 2006 12:39 pm Post subject: To find total length |
|
|
Novice
Joined: 08 Aug 2006 Posts: 14
|
I need to find the total length of record which is in CWF format.I used the following esql but nothing is return. I am using WBIMB 5 on windows
SET RecordLength = LENGTH(OutputRoot.MRM.HEADER-DATA); |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 16, 2006 12:49 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What does the ESQL documentation on the LENGTH function say?
Does it say that it works on sub-trees?
Does HEADER-DATA have child fields? Or is it a single value?
You should spend some more time reading the documentation, and definitely get some training on this product. It's complicated and you are missing some key concepts, I think. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
rasol |
Posted: Wed Aug 16, 2006 1:14 pm Post subject: |
|
|
Novice
Joined: 08 Aug 2006 Posts: 14
|
Thank for ur response jeff.
I am sorry with HEADER-DATA which is one of the element in the message but I want the length of entire message which is in CWF format.
SET RecordLength = LENGTH(OutputRoot.MRM);
I can find the total length,if I convert the message to BLOB but i cannot do the same with the original output CWF message.
I am going thru ESQL documentation and also thru the forum. Nothing I can see probably I am missing something/oversight. |
|
Back to top |
|
 |
JT |
Posted: Wed Aug 16, 2006 2:37 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
I can find the total length,if I convert the message to BLOB but i cannot do the same with the original output CWF message.
|
Can you clarify what you mean by "original output CWF message"? |
|
Back to top |
|
 |
rasol |
Posted: Wed Aug 16, 2006 3:58 pm Post subject: |
|
|
Novice
Joined: 08 Aug 2006 Posts: 14
|
Sorry for the confusion.I mean Output CWF message.
I am converting input XML message to CWF format.One of the fields in CWF format needs the RECORD LENGTH because the CWF layout uses the depending on clause.
Hope you understand!!! |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Aug 16, 2006 4:02 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rasol wrote: |
Sorry for the confusion.I mean Output CWF message.
I am converting input XML message to CWF format.One of the fields in CWF format needs the RECORD LENGTH because the CWF layout uses the depending on clause.
Hope you understand!!! |
As we are talking about CWF format the record length should be fixed depending on type and you should be able to code for it.
Now if you need to now the number of repetitions you should be able to get this too.
And none of those have anything to do with the total length of the message... but for the fact that they contribute to it's calculation...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rasol |
Posted: Wed Aug 16, 2006 10:32 pm Post subject: |
|
|
Novice
Joined: 08 Aug 2006 Posts: 14
|
fjb_saper your exactly correct and I can figure out the length since CWF is fixed format.
for eg
01 A.
05 B PIC X(05)
05 C PIC X(05)
Now I can hardcode in my esql 10 as record length.
01 A.
05 B PIC X(05)
05 C OCCUR 10 TIMES DEPENDING ON B
10 D PIC X(05).
But if its with depending ON Clause then I need to calculate C * D + B. This has to be hardcoded in esql.
If there is change in the COPYBOOK layout then I have to modify the esql.To avoid this situation and to code efficiently. I thougth of getting the length of message and is it possible in WBI?.
Please advise. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Aug 17, 2006 2:17 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You certainly cannot find the length by applying the LENGTH function to the root of the MRM tree. LENGTH only works on BIT, BLOB and CHARACTER data types. The docs make that perfectly clear.
Use ASBITSTREAM, find the length of the BLOB, and then output the message in the BLOB domain. |
|
Back to top |
|
 |
|