Skip to main content

Problem:

Net Express 5.0.

Is it possible to turn the newline x"0A" character off when writing an XML stream to :cgi:.

Resolution:

The Net Express 5.0 documentation includes the following:

New syntax for select statement is:

     SELECT xmlfile ASSIGN TO [[NOT] LINE ADVANCING] FILE

Of course if "NOT LINE ADVANCING" is specified then no line-feeds would be included in the output.  How to write a newline character at the end of the XML stream?

This can be achieved as follows:

...

       select xml-file

           assign to not line advancing file-name

           organization is xml

           document-type is "CompanyTrans.xsd"

           file status is xml-file-status.

...

       01 newline pic x(02) value x"0d0a".

....

           *> Write to the internal XML document

           write xml-Trans key is all xml-Trans

           if xml-file-status < 0

               display "Error writing to file: " xml-file-status

               perform EndProgram

           end-if

           *> Add newline at the end

>>>       write xml-Trans key is plain-text newline

           *> Write the whole XML document to file

           write xml-Trans

           if xml-file-status < 0

               display "Error writing to file: " xml-file-status

               perform EndProgram

           end-if

Old KB# 1215