Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Split XML data file into multiple files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bhima patra

New User


Joined: 02 Jan 2015
Posts: 5
Location: India

PostPosted: Mon Jan 05, 2015 3:48 pm    Post subject: Split XML data file into multiple files
Reply with quote

I have XML data in a file as given below.There may be N number sets, each set of XML data separated by space.We have requirement to copy the data into five files.Data in five Output files need be in same format, set of XML data separated by spaces.

<?xml version="1.0" encoding="IBM037"?><InvoiceDetail-List>
" DivisionCode="1001" HeaderCharges="0.00" HeaderDiscount="
="" TotalAmount="139.30" TotalCharges="16.11" TotalDiscount
OrderType="SALES" SellerOrganizationCode="Target.com"><Extn
</InvoiceDetail></I nvoiceDetail-List>

<?xml version="1.0" encoding="IBM037"?><InvoiceDetail-List>
erTax="0.00" InvoiceNo="2849456" InvoiceType="INFO" LineSub
506722" OrderType="SALES" SellerOrganizationCode="Target.co
Christopher" LastName="Miller" MiddleName="" MobilePhone=""
</InvoiceDetail></InvoiceDetail-List>

<?xml version="1.0" encoding="IBM037"?><InvoiceDetail-List>
erTax="0.00" InvoiceNo="2849456" InvoiceType="INFO" LineSub
ExtnNetRefundAmount="0.00"/><PersonInfoShipTo City="Monroev
Christopher" LastName="Miller" MiddleName="" MobilePhone=""
</InvoiceDetail></InvoiceDetail-List>

<?xml version="1.0" encoding="IBM037"?><InvoiceDetail-List>
erTax="0.00" InvoiceNo="2849456" InvoiceType="INFO" LineSub
0" TotalTax="0.00"><Extn ExtnConcessionReasonCode="DE" Extn
Christopher" LastName="Miller" MiddleName="" MobilePhone=""
</InvoiceDetail></InvoiceDetail-List>

<?xml version="1.0" encoding="IBM037"?><InvoiceDetail-List>
erTax="0.00" InvoiceNo="2849456" InvoiceType="INFO" LineSub
Christopher" LastName="Miller" MiddleName="" MobilePhone=""
</InvoiceDetail></InvoiceDetail-List>
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jan 05, 2015 5:30 pm    Post subject: Reply to: Split XML data file into multiple files
Reply with quote

Your XML is a mess, but let's leave that aside (perhaps just a pasting problem).

I'd use WHEN=GROUP with BEGIN= for <?xml version=. Don't know whether you have fixed- or variable-length records, but I'd END= appropriately for the blank line as well. PUSH an ID=1. Then have five OUTFILs, with INCLUDE= for 1, for the first, 2 for the second, etc.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1218
Location: Israel

PostPosted: Mon Jan 05, 2015 6:55 pm    Post subject: Re: Split XML data file into multiple files
Reply with quote

bhima patra wrote:
There may be N number sets, ... requirement to copy the data into five files. Data in five Output files ...

So, is that N or 5 files ? What will be their names ?
And how do you decide which set goes into which file ?

In your XML, it seems values are passed as attributes, not as elements.
Whoever prepared that file should probably think again.
Back to top
View user's profile Send private message
bhima patra

New User


Joined: 02 Jan 2015
Posts: 5
Location: India

PostPosted: Mon Jan 05, 2015 7:13 pm    Post subject: Re: Split XML data file into multiple files
Reply with quote

Marso wrote:
bhima patra wrote:
There may be N number sets, ... requirement to copy the data into five files. Data in five Output files ...

So, is that N or 5 files ? What will be their names ?
And how do you decide which set goes into which file ?

In your XML, it seems values are passed as attributes, not as elements.
Whoever prepared that file should probably think again.


I mean N number of XML record sets separated by space in input file.
Back to top
View user's profile Send private message
bhima patra

New User


Joined: 02 Jan 2015
Posts: 5
Location: India

PostPosted: Mon Jan 05, 2015 7:15 pm    Post subject: Re: Split XML data file into multiple files
Reply with quote

bhima patra wrote:
Marso wrote:
bhima patra wrote:
There may be N number sets, ... requirement to copy the data into five files. Data in five Output files ...

So, is that N or 5 files ? What will be their names ?
And how do you decide which set goes into which file ?

In your XML, it seems values are passed as attributes, not as elements.
Whoever prepared that file should probably think again.


I mean N number of XML record sets separated by space in input file.


Need to Split into five files
Back to top
View user's profile Send private message
bhima patra

New User


Joined: 02 Jan 2015
Posts: 5
Location: India

PostPosted: Mon Jan 05, 2015 7:23 pm    Post subject: Re: Reply to: Split XML data file into multiple files
Reply with quote

Bill Woodger wrote:
Your XML is a mess, but let's leave that aside (perhaps just a pasting problem).

I'd use WHEN=GROUP with BEGIN= for <?xml version=. Don't know whether you have fixed- or variable-length records, but I'd END= appropriately for the blank line as well. PUSH an ID=1. Then have five OUTFILs, with INCLUDE= for 1, for the first, 2 for the second, etc.


file is FB,LRCL=200, Please provide the syntex.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jan 05, 2015 8:41 pm    Post subject: Reply to: Split XML data file into multiple files
Reply with quote

The syntax is in the manual.

For an FB I'd code the END= as (1,200,CH,EQ,C' ').
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Jan 05, 2015 11:26 pm    Post subject: Reply to: Split XML data file into multiple files
Reply with quote

Quote:
Need to Split into five files

You already told that ...
WHAT ARE THE RULES

round robin will need just one pass
file1 => 1 6 11 ...
file2 => 2 7 12 ...
file3 => 3 8 13 ...
file4 => 4 9 14 ...
file5 => 5 10 15...
contiguous split 2 passes ( the first one to count the number of records )
file1 => 1 2 3 4 5 6 ...
file2 => ...
file3 => ...
file4 => ...
file5 => ...

depending on N files 2 to 5 might contain one record less
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us