|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
CWF - repeating field |
« View previous topic :: View next topic » |
Author |
Message
|
kspranava |
Posted: Tue Aug 30, 2005 3:00 am Post subject: CWF - repeating field |
|
|
 Centurion
Joined: 27 Apr 2003 Posts: 124
|
Hi Gurus,
While creating a Message definiton file using the following COBOL copybook, am stumped with Syntax error stating 'Cobol file cannot be imported due to following errors' at line '03 ItemDetails OCCURS 0 TO 5 TIMES'
01 StockItem.
03 TranType PIC X(3).
88 TranUpdate VALUE "UPD".
88 TransAdd VALUE "ADD".
88 TransDelete VALUE "DEL".
88 TransRead VALUE "RET".
03 ItemDetails OCCURS 0 TO 5 TIMES.
05 ItemNo PIC X(10).
05 ItemDescr PIC X(20).
I have a repeating field (ItemDetails) which may repeat 0 to 5 times and no reference field available too.
In short, in a CWF repeating field, when the exact repeat count or ref. field are unknown how to proceed further?
Thanks in advance. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Aug 30, 2005 4:30 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
In short, CWF can't be used when the repeat count is unknown, not to process input data. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
EddieA |
Posted: Tue Aug 30, 2005 8:40 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
I'd be interested to know how, in your COBOL program, you know how many repeats there are when you read that record.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
recallsunny |
Posted: Tue Aug 30, 2005 9:00 am Post subject: |
|
|
 Disciple
Joined: 15 Jun 2005 Posts: 163 Location: Massachusetts
|
As has been noted, CWF does not support repeat groups unless you set the Repeat Reference or a fixed Repeat count.
Here is a workaround: You could add an Integer Field at the start of the Message Definition and set it as Repeat reference to the repeating group. Now within the message flow, Parse the Incoming Message as BLOB. Determine the Length of BLOB and substract the StockItem block length from it (assuming that Stock Item block is not repeating). Now you should be able to determine the Number of ItemDetails by dividing the remaining BLOB length with the Length of each Item Detail group.
Code: |
ItemStock+ItemDetail+ItemDetail+ItemDetail = InRoot
Length(InRoot) - Length(ItemStock) gives you total length of (ItemDetail+ItemDetail+ItemDetail) block.
Divide: Length(ItemDetail+ItemDetail+ItemDetail) / Length(ItemDetail)
Gives you number of occurences of ItemDetail.
|
Append this Count to the InputMessage in place of Integer Field and ResetContent to MRM. Your Message is now available in CWF format. |
|
Back to top |
|
 |
kspranava |
Posted: Tue Aug 30, 2005 7:16 pm Post subject: |
|
|
 Centurion
Joined: 27 Apr 2003 Posts: 124
|
Hi All,
Thanks for clarifying the doubt. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|