Author |
Message
|
bremen |
Posted: Wed Jan 03, 2007 11:42 pm Post subject: Length Count issue !!!!!!!!!!! |
|
|
Novice
Joined: 28 Dec 2006 Posts: 16 Location: Hindustan
|
Hi,
My flow i/p is xml and o/p is CWF1(MB V5,UNIX). portion of i/p looks like this
<NOTE_TXT>---------</NOTE_TXT>(Maximu lenght can be up to 3000 chars). In the portion of o/p copybook looks like this
10 NOTE-TXT.
15 NOTE-TXT-LEN PIC S9(02) COMP.
15 NOTE-SEG OCCURS 1 TO 15 TIMES
DEPENDING ON NOTE-TXT-LEN
PIC X(200).
I am trying to generate o/p NOTE_SEG as chunks 200 from i/p.
Getting the following problem(CWF) when the i/p NOTE_TXT is having more than 200 char.
The message has a maximum or minimum length of 200 in the dictionary. The actual length is 1084.
How to set "Length Count" attribute for NOTE-SEG as per the req's
Thanks. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 04, 2007 1:57 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You need to
- Set NOTE-TXT-LEN to length(NOTE_TXT) / 200
- split NOTE_TXT into NOTE-TXT-LEN chunks of 200 chars and create a syntax element in the message tree for each chunk. |
|
Back to top |
|
 |
bremen |
Posted: Thu Jan 04, 2007 9:02 am Post subject: |
|
|
Novice
Joined: 28 Dec 2006 Posts: 16 Location: Hindustan
|
Kimbert,
I did like this:
SET OutputRoot.MRM.NOTE-TEXT.NOTE_SEG = Environment.Variables.NOTE_TXT;
DECLARE noteTxtCount INTEGER ;
SET noteTxtLength = LENGTH(Environment.Variables.NOTE_TXT);
SET OutputRoot.MRM.NOTE-TEXT.NOTE-TXT-LEN = CAST(noteTxtLength/200 AS INTEGER) + 1;
Still getting The message has a maximum or minimum length of 200 in the dictionary. The actual length is 1084
Kimbert : i didn't understand this "split NOTE_TXT into NOTE-TXT-LEN chunks of 200 chars and create a syntax element in the message tree for each chunk."
If i/p is 201 char's thn NOTE-TXT-LEN = 2; and i have to pass 400 chars(201 from i/p+SPACES(199))
If i/p is 1001 char's thn NOTE-TXT-LEN = 6; and i have to pass 1200 chars(1001 from i/p+SPACES(199))
How to set this dynamically depending on NOTE-TXT-LEN
can anyone help me to sort this problem . |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 04, 2007 1:26 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
i didn't understand this "split NOTE_TXT into NOTE-TXT-LEN chunks of 200 chars and create a syntax element in the message tree for each chunk." |
Then you need to get some training. You cannot do this transformation automatically - you need to write some ESQL in a Compute node. Read the docs and search this forum for examples of 'CREATE LASTCHILD'. |
|
Back to top |
|
 |
bremen |
Posted: Thu Jan 04, 2007 2:13 pm Post subject: |
|
|
Novice
Joined: 28 Dec 2006 Posts: 16 Location: Hindustan
|
Kimbert,
I already used the CREATE function in my compute node to build the XML msg under EV's. I searched the forum too.But no chance.u pls giv me a brief esql/hint how to do that.
Thanks, |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 04, 2007 3:13 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you know how to use Create Field, the rest of it is basic programming.
You have to create several fields, each of which are no larger than 200 characters long. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|