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: 7315

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: 1228
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: 7315

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: 10257
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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