> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:ibm-m...@bama.ua.edu] On Behalf Of Tim Brown
> Sent: Wednesday, November 04, 2009 1:11 PM
> To: IBM-MAIN@bama.ua.edu
> Subject: xml filess to sequential
> 
>  
> Can an xml file be transferred to the mainframe and
> still look like an xml file in TSO ?
> 
> Whatever I transfer the file it gets wrapped.
> 
> <?xml version="1.0" standalone="yes"?>  <DATAPACKET 
> Version="2.0"><METADATA><FIELDS><FIELD attrname=
> "LOCN_ID" fieldtype="i4"/><FIELD attrname="SERIAL_NUM" 
> fieldtype="string" WIDTH="12"/><FIELD attrnam
> e="POSITION" fieldtype="i2"/>
> 
> Would like this
> 
> <?xml version="1.0" standalone="yes"?> 
>  <DATAPACKET Version="2.0">
>    <METADATA>
>     <FIELDS>
>        <FIELD attrname="SERIAL_NUM" fieldtype="string" WIDTH="12"/>
> 
> Tim Brown

It appears that the original file does not have any line breaks in it. When you 
ftp into a sequential file, ftp will either truncate or wrap at the LRECL. This 
latter is what you are seeing. IMO, the "proper" thing would be to have the 
originator use an XML "pretty print" function to format the XML as you show it 
latter in your email.

Now, assuming your originator is much like the ones that I deal with ("Hey - 
that's the way it is! Learn to deal with it!"), then you could do something 
like the following, if you have Co:Z installed.

//CONVERT EXEC PROC=COZBATCH
//SYSOUT DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//I DD DISP=SHR,DSN=input.xml.file
//O DD DSN=output.xml.file,
// RECFM=VB,LRECL=23994,BLKSIZE=0,DSORG=PS,
// UNIT=SYSDA,SPACE=(cyl,(pri,sec))
//STDIN DD *
fromdsn -b //DD:I | \
sed 's/>/>\n/g' | \
todsn //DD:O
/*
//

What the above does is copy your existing file to "stdout" using "fromdsn" to 
read the sequential file from DD name I. It pipes this into a "sed" command 
which put a newline after each > character. This output is then piped into 
"todsn" which puts it back in a sequential file defined with the DD name O.

You could possibly do something similar using REXX, too.

--
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * (817)-961-6183 cell
john.mck...@healthmarkets.com * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to