Our group is going to create an XML interface between the Web and our mainframe. We are currently using CICS TS 1.3 and OS390 and are not yet to Enterprise COBOL V3. If at all possible we would like to receive the XML document on the mainframe and perform the parsing there rather than parse the message and then send it to the mainframe. I have been researching the SOAPS package but it lacks a parser. One of our requirements is that whatever we use it must be within the IBM package that we already have. Is there an IBM parser that's available for our use at HUD?
I think you need to revisit the decision not to upgrade to Enterprise COBOL. The parsing built in function will ASSIST in the unraveling of XML-based information. However, that being said there is no reason why you cannot do all the data extraction yourself by good-old substringing techniques. But I give a strong warning about avoiding anything that repeats - this only complicates matters. You also have to accept that no checking on the XML flow itself will be done (it matches the DTD and is well formed -- so that
does not occur).
What you do have to be careful about is writing code that can accept the variability of information. You have got especially to cope with the fact that white space is deemed to be irrelevant. On the plus side, you seem to have control of the Web pages yourself and so can define the format of the XML data (by which I mean you can ignore optimizations).
If you can get access to the Nordic Guide/Share Web site, there is an interesting presentation there (by me, naturally!) on the CICS SOAP SupportPac that goes into manual parsing techniques.
To give an example: If you have: '
' you have got to cope with '
' in your parsing routine, along with all other variants. Life is made a LOT easier if you insist on everything being in UPPERCASE.
So, proceed by knowing all the
s that you can have and then proceed to extract each one in turn into a structure -- which you will have prefilled with defaults.
To access a flat
data XML arrangement you will need to implement logic like:
scan for the < skip to the next non-blank extract up to the next blank or > --- this gives you the relevant KEY, and so you know what field you are processing skip to the next > (or stay put if the aforementioned > was located) skip to the next non-blank character -- if this is a < then the ITEM is empty extract up to the next < -- this gives you the VALUE for the KEY [If you were using Rexx, then this function could be done via : parse upper xmlflow . '<' key '>' value '<' . '>' xmlflow key = translate(strip(key,'B')) ; value = translate(strip(value,'B')) until xmlflow has all been processed]
You then need to get rid of leading and trailing blanks from the VALUE, check the length of it (so it fits in the structure), validate it is all numeric (if needed) and do general formatting checks. Once you think the VALUE is acceptable then you can use the KEY (via some sort of Select statement) and stick it into the relevant bit of the Structure.
If you are required to cope with mixed case KEYs or VALUEs then the easiest way is to copy the XML flow into another area, and do the extraction on the copy that has been folded to Uppercase -- you want to save the Position & Length of the VALUE for possessing.
Things are obviously more complicated than this if you choose to use a nested arrangement like
but this design should cope with a flat
CICS Technical Strategist -- CICS expert at Search390.com
Editor's note: Do you agree with this expert's response? If you have more to share, post it in one of our
Dig Deeper on IBM system z and mainframe systems
For better mainframe capacity planning, how do I convert CPU hours to MIPS? And is there a way to calculate the relationship between MIPS and MSUs?
I have two years of experience in mainframe technology, currently working as a mainframe developer. I want to change to Java technology.
I want to replicate DB2 from the mainframe to an AIX box since it's cheaper and the copy can be used for testing. Is this possible?
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.