MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

XML formatting

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Thu Sep 11, 2014 10:32 pm    Post subject: XML formatting Reply with quote

Hi,
We have to process XML files in mainframe environment using COBOL programs. However, while we receive these files it's not well formatted the way we see the XML files using internet explorer or any other software used to view the XML files. The records are spanned at times, which makes the file reading difficult. For instance, we are expecting the mainframe file as below (sample xml, not the original):

Example -1
Code:

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications
      with XML.</description>
   </book>
</catalog>

Sometimes we receive the file in mainframe as below:
Code:

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author><title>XML Developer's Guide</title><genre>Computer</genre><price>44.95</price<publish_
date>2000-10-01</publish_date>
      <description>An in-depth look at creating
applications
      with XML.</description>
   </book>
</catalog>

OR like this:
Code:

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author><title>XML
Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications
      with XML.</description>
   </book>
</catalog>

Can we format the xml file using ICETOOL or any other utility? I mean pair the xml tag (<field1> some value </field1>) as one record after another as described in this first example (Example 1). The input file is 2000 byte length VB. Appreciate any help on this...
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Sep 12, 2014 3:39 pm    Post subject: Reply with quote

somuk,

With a VB file it gets tricky with number of XML tags are unknown. Do you know all the possible XML tags? I meant the sub tags like <author>, <genre> ... If the number of tags are known we can somehow manage it but remember it would require a min of 2 passes of data.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Sat Sep 13, 2014 11:50 am    Post subject: Reply with quote

Thanks Kolusu.
The XML file is having around 100+ tags. We are OK, even if one record contains multiple tags and values. However, it shouldn't split the values into two records.

This is OK:
Code:

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications
      with XML.</description>
   </book>
</catalog>


This is also OK:
Code:

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95
</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications
      with XML.</description>
   </book>
</catalog>



This one is causing the issue - value is getting spanned into two records:

Code:

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author><title>XML
Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications
      with XML.</description>
   </book>
</catalog>


Is it possible to do the following:
- If the last character of each record is not ">" then read backward the current record till we hit "<".
- Copy this partial record and append with the next record. However, the challenge is that we need to make sure the new record is not getting spanned.

Please see below the list of all tags:
    TrxnHistory
    CreateDate
    PerStartDate
    PerEndDate
    MgmtCode
    DlrCode
    IntCode
    TrxnRec
    TrxnRecon
    ProcessDate
    FundAcctID
    AcctDesig
    DlrAcctID
    RepCode
    IntAcctID
    AccType
    OtherMgmtCode
    OrdID
    OrigOrdID
    CorrectnFlg
    PymtID
    OrdSrc
    OrdType
    SrcID
    MgmtSpfc
    SellCof
    BuyCof
    SwitchCof
    ETCof
    ITCof
    DistribCof
    ROC
    TrxnTyp
    TrxnTypDtl
    ProdEvntInd
    CntbWdCode
    OrdFundID
    SellAAFund
    ParentFundID
    SellFund
    SellICT
    SellSegMat
    TradeDate
    SettlDate
    AltPayeeFlg
    AltDeliverFlg
    FundID
    Currency
    SequenceNum
    GrossAmt
    Dedns
    ShortTermFee
    AdminFee
    MgmtFee
    PeformFee
    OtherFee
    Penalty
    DSCAmount
    SalesTax
    FedWHoldTax
    ProvWHoldTax
    LSIFClawbackFed
    LSIFClawbackProv
    Clawback
    TotalDedns
    NetAmt
    DilAmt
    NAV
    UnitTrxnd
    TotalIssued
    TotalUnissued
    AveCost
    SettlMethd
    SettlAmt
    CntbPd
    BuyAAFund
    BuyFund
    BuyICT
    Demo
    DivOpt
    ClientPdComm
    FundPdComm
    HoldBack
    SwitchOut
    SwitchIn
    TaxEvnt
    ExchangeRate
    ToAcct
    AcctType
    FromAcct
    TrnsfrAAFund
    TrnsfrFund
    OrigNtwrk
    ITOut
    ITIn
    Owner
    ClientInfo
    Individual
    TitleCode
    LastName
    FirstName
    SIN
    BirthDate
    Gender
    Distrib
    DistribFund
    Redirect

_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Sep 15, 2014 11:32 am    Post subject: Reply with quote

somuk wrote:
Thanks Kolusu.
The XML file is having around 100+ tags. We are OK, even if one record contains multiple tags and values. However, it shouldn't split the values into two records.


somuk,

hmm 100+ tags? What version of DFSORT are you running? If you are running DFSORT V2R1 then you can have upto 1000 parse fields but if you are not then you are limited to just 100 fields. Can you run the following JCL and show me the sysout so that we can determine the level of DFSORT you have?

Code:

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD *           
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *           
  OPTION COPY             
//*     

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Mon Sep 15, 2014 2:42 pm    Post subject: Reply with quote

Hi Kolusu,

Looks like we are using DFSORT V1R12

Code:

RECORD TYPE IS F - DATA STARTS IN POSITION 1                                 
C5-I12416 C6-K90026 C7-K94453 C8-K94453 E9-K60824 C9-BASE   E5-K80744 E7-I1241
BLOCKSET     COPY  TECHNIQUE SELECTED                                         
VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE 
- CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 15:37 ON MON SEP 15, 20
  OPTION COPY                                                           001600

_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Sep 15, 2014 2:46 pm    Post subject: Reply with quote

somuk wrote:
Hi Kolusu,

Looks like we are using DFSORT V1R12



With VB files and parse limitation, I would say you are better off with a simple cobol program that can split/join the records quite easily.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Tue Sep 16, 2014 7:57 pm    Post subject: Reply with quote

Yeah.. That's right, Kolusu..
We will try out some Rexx or COBOL solution.. Thanks for your time..
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group