[Info-vax] *.xml files - carriage return's go into file in VMS - how toremove CR's?

David J Dachtera djesys.no at spam.comcast.net
Sun Mar 29 16:45:24 EDT 2009


JF Mezei wrote:
> 
> Chuck Aaron wrote:
> > The text file is created on VMS from an Adabas Natural program. It
> > does contain the embedded CR/LF.
> 
> It contains the CR and the LF as part of the variable length record ?

Yes, that's what he's saying. I worked with output from ADABAS/Natrual
some years ago - I've seen this before.

> In
> other words:
> 
> create temp.txt
> Hello World
> 
> yields:
> 
> FFFF0064 6C726F57 206F6C6C 6548000B ..Hello World... 000000
> 
> An 11 byte record (000B). The last byte is 0x64 (d).
> 
> Are you saying that in your case, you have:
> 
> FF0A0D64 6C726F57 206F6C6C 6548000D ..Hello World... 000000
> 
> A 13 byte record ending with CR/LF inside the variable length record ?
> 
> I assume you cannot change the VMS application to create the files
> properly ? (opening it as a stream file would cause the application's
> insistance on writingf CR/LF itself to provide proper record separators).

No, it is written by ADABAS/Natural, a third-party product. There may be
options in the product to correct the behavior at run-time, but that may
be beyond the limits of his environment and/or scope of engagement.

> I would try to CONVERT the .XML document to one of the STREAM (STREAM,
> STMLF STMCR) formats, and then convert it back to variable length to see
> how it handles it. It is possible that you would end up with a blank
> line between each lines.

You can avoid the blank records by doing a double conversion:

$! First, COPY from the null device to create an empty file
$ COPY NLA0: target_filespec
$!
$! Reset the target file's attributes to record format = undefined
$ SET FILE/ATTR=RFM=UDF target_filespec
$!
$! APPEND the source file data to the modified target file:
$! (Ignore the INCOMPAT message, or DEFINE/USER both SYS$OUTPUT and
$!  SYS$ERROR to the null device.)
$ APPEND source_filespec target_filespec
$!
$! The above converts the <CR><LF> pairs from extraneous data to 
$! significant data (record terminator string).
$!
$! Reset the target file's attributes once more (from undefined
$! to stream).
$ SET FILE/ATTR=RFM=STM target_filespec

Now, the <CR><LF> pairs are still there, but hey ahve a proper meaning
to RMS andor/ DOS/Windows. The resulting file can safely be FTP'd as
BINARY to Windows and should display the expected behavior there.

See this URL: http://www.djesys.com/vms/mentor/rms.html#rfmt for more
information on RMS record formats.

D.J.D.



More information about the Info-vax mailing list