Author |
Message
|
DELLIPIZ |
Posted: Tue Oct 12, 2004 6:47 pm Post subject: Variable length fields |
|
|
Acolyte
Joined: 08 Oct 2003 Posts: 70
|
Hi,
When creating an MRM, how would you create a variable length field, using CWF?
I have a COBOL field that can be either 30 - 300 characters.
Thanks!
-Lori |
|
Back to top |
|
 |
siliconfish |
Posted: Tue Oct 12, 2004 7:02 pm Post subject: |
|
|
 Master
Joined: 12 Aug 2002 Posts: 203 Location: USA
|
You can set the "Length Units" in the CWF tab to "End of Bitstream"
Quote: |
End of Bitstream. All data to the end of the bitstream is processed. (Valid only if this element is the last in the message. If you select this value, you do not need to enter a value for the properties Length Count or Length Value Of.) |
_________________ siliconfish |
|
Back to top |
|
 |
DELLIPIZ |
Posted: Tue Oct 12, 2004 7:11 pm Post subject: |
|
|
Acolyte
Joined: 08 Oct 2003 Posts: 70
|
Hi again,
Well, my input is in XML and my output structure needs to look like this in PL1:
FIELD1 CHAR(250) VAR;
FIELD2 CHAR(3000) VAR;
FIELD3 CHAR(1);
Can I still use the 'End of Bitstream' when it is not the last field in the structure?
Thanks!
-Lori |
|
Back to top |
|
 |
JT |
Posted: Tue Oct 12, 2004 7:53 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
|
Back to top |
|
 |
JLRowe |
Posted: Wed Oct 13, 2004 1:15 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
In CWF you need a length count element for each variable length field, this is the only way of doing it (except for the last element which can run to the end of bitstream). |
|
Back to top |
|
 |
EddieA |
Posted: Wed Oct 13, 2004 8:41 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
I have a COBOL field that can be either 30 - 300 characters. |
Then, if I remember my COBOL correctly (from far too many years ago), you must also have a field that contains the length of that field. I don't think COBOL supports any "other" type of variable length, like "null terminated".
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
kirani |
Posted: Wed Oct 13, 2004 8:49 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
This will not work for CWF. _________________ 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 |
|
 |
kimbert |
Posted: Wed Oct 13, 2004 4:35 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Looks like the last field is only one character, so why not omit it from your message definition. Then you can use ASBITSTREAM to serialize the message into a string, and just stick the final character on the end.
(I have not tried this, but I think it should work) |
|
Back to top |
|
 |
shanson |
Posted: Thu Nov 04, 2004 1:47 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
A PL/I CHAR VAR is a string preceded by (I think) a 2 byte length. That's what the CWF string physical type 'Encoded String 2' is designed to handle. All you have to do is use that. |
|
Back to top |
|
 |
DELLIPIZ |
Posted: Fri Nov 12, 2004 5:27 am Post subject: |
|
|
Acolyte
Joined: 08 Oct 2003 Posts: 70
|
Hi,
I was looking at the above advice:
A PL/I CHAR VAR is a string preceded by (I think) a 2 byte length. That's what the CWF string physical type 'Encoded String 2' is designed to handle. All you have to do is use that.
--------------------------------
Please forgive my cluelessness... can you show me what my CWF tab for Field2 should look like.
FIELD2 CHAR(3000) VAR;
Thanks!
-Lori |
|
Back to top |
|
 |
shanson |
Posted: Mon Nov 15, 2004 4:31 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Physical Type = Length Encoded String 2
Length Count = <greyed out>
The data is preceded by 2 bytes that give the length of the data. Hence Length Count has no meaning. If you wish to validate that the length of the data is not greater than 3000 then you should add a maxLength facet to the simple type. |
|
Back to top |
|
 |
|