IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Split XML data file into multiple files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jan 05, 2015 5:30 pm
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: 1353
Location: Israel

PostPosted: Mon Jan 05, 2015 6:55 pm
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
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
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jan 05, 2015 8:41 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jan 05, 2015 11:26 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
Search our Forums:

Back to Top