Page 1 of 1

Unstring XML tags from Pic X(400000)

PostPosted: Tue Mar 20, 2012 10:03 pm
by Mann_B
Hi Every one,

I Am having an huge XML message of 4 lakhs bytes which is moving to working storage pic X(400000). And I have to pull the XML tag data from this message.I Cannot parse complete XML as it not required, so I am using UNSTRING to extract the data from PIC X(400000). i have to unstring 80 such tags from message which is CPU consuming. Do we have any options other than UNSTRING to reduce CPU.

Eg:
WS-Message is <AAAA>xxx </AAAA><bbbbb>yyyy</bbbb><ccccc>zzzzzz</ccccc>..... like this of X(400000).
WS-STR-DTL-A = PIX X(20).

UNSTRING WS-Message
DELIMITED BY '<ccccc>'
OR '</ccccc>'
INTO WS-STR-DTL-A

Using above code. I am not able to extract the tag and data. every time its getting <AAAA>xxx </AAAA> into WS-STR-DTL-A.

Could you please help me on this. Is I am missing anything on it.

Thanks,

Re: Unstring XML tags from Pic X(400000)

PostPosted: Tue Mar 20, 2012 10:11 pm
by BillyBoyo
Delimited by is telling UNSTRING what ends the string, not what the string is bounded by.

Are you sure you can't use the XML processing?

How many of these huge things will you be processing at once?

Have a look in the manuals for the full capabilities of UNSTRING and look at INSPECT as well.

Re: Unstring XML tags from Pic X(400000)

PostPosted: Tue Mar 20, 2012 10:17 pm
by Mann_B
Thanks BIllyboyo,

I cannot use XML parser.. because it too huge and not accepting by the design.
For each pic X(400000) message. we have to unstring 80 tags like this and will process around 200- 300 message in each run.

Re: Unstring XML tags from Pic X(400000)

PostPosted: Wed Mar 21, 2012 1:20 am
by dick scherrer
Hello,

Your example appears to be inconsistent . . .
UNSTRING WS-Message
DELIMITED BY '<ccccc>'
OR '</ccccc>'
INTO WS-STR-DTL-A

Using above code. I am not able to extract the tag and data. every time its getting <AAAA>xxx </AAAA> into WS-STR-DTL-A.

From the sample data posted, it will help if you show the desired result.

Re: Unstring XML tags from Pic X(400000)

PostPosted: Wed Mar 21, 2012 1:35 am
by BillyBoyo
I have to say, if this is beyond some XML limit, then it was a bad idea to design it that way. Everywhere along the line there will be a problem, because everywhere will have to have specific code for it.

If the designer wanted to use XML, then XML-parsers should be able to process it. If there is no need for XML-parsers, why in XML format?

Do you know the order in which the information that you need will appear? Or is the order potentially "random" (which will be bad news for "performance")?

I don't even suppose all the "tags" are the same length, are they?

The more information that you can give, the better will be the chance of getting an answer that is "acceptable".

However, I'd say for now, the "design" of all this should be reviewed.

Re: Unstring XML tags from Pic X(400000)

PostPosted: Wed Mar 21, 2012 2:46 am
by Robert Sample
I cannot use XML parser.. because it too huge and not accepting by the design.
For each pic X(400000) message. we have to unstring 80 tags like this and will process around 200- 300 message in each run.
This is complete and utter GARBAGE! I've got XML PARSE programs that run on input variables of 10 MILLION bytes -- twenty-five times larger than yours. And there is absolutely no problem with using XML PARSE on that much data. And I extract over 2000 records, each with about 20 separate XML tags, from that data.

So if you don't want to do the work to make XML PARSE function, say so -- since it IS a good bit of work -- but don't blame the system for YOUR shortcomings. And if the endings are different -- </aaaa>, </bbbb>, </CCCC?> or whatever -- then you will not be able to use UNSTRING. You will need to use reference modification, which I would consider to take more work and be slower than using XML PARSE anyway.