Unstring XML tags from Pic X(400000)



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Unstring XML tags from Pic X(400000)

Postby Mann_B » Tue Mar 20, 2012 10:03 pm

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,
Mann_B
 
Posts: 79
Joined: Wed Mar 31, 2010 11:48 am
Has thanked: 0 time
Been thanked: 0 time

Re: Unstring XML tags from Pic X(400000)

Postby BillyBoyo » Tue Mar 20, 2012 10:11 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Unstring XML tags from Pic X(400000)

Postby Mann_B » Tue Mar 20, 2012 10:17 pm

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.
Mann_B
 
Posts: 79
Joined: Wed Mar 31, 2010 11:48 am
Has thanked: 0 time
Been thanked: 0 time

Re: Unstring XML tags from Pic X(400000)

Postby dick scherrer » Wed Mar 21, 2012 1:20 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Unstring XML tags from Pic X(400000)

Postby BillyBoyo » Wed Mar 21, 2012 1:35 am

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Unstring XML tags from Pic X(400000)

Postby Robert Sample » Wed Mar 21, 2012 2:46 am

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post