Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 7314

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: 1275
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: 7314

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: 10457
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 IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts 3270 Data stream error Benchwarmer CICS 4 Tue Apr 17, 2018 12:06 am
No new posts Comparing two sequential files Mohan Kothakota COBOL Programming 14 Mon Apr 16, 2018 6:35 pm
No new posts How to list data set names with diffe... murali.andaluri CLIST & REXX 8 Thu Apr 12, 2018 11:33 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us