Skip to main content
Dominique Sacre
Rocketeer
Feb 15, 2013 10:31 PM UTC

How to preserve case of data names for XML tags in XML GENERATE (Server Express)

Problem:

By default the XML GENERATE statement converts data names to upper case to generate XML tags.

The following:

01 myXML pic x(1000).

01 myItem1.

     05 myItem2 pic x(10) value "my value".

...

Xml generate myXML from myItem1

would generate

"<MYITEM1><MYITEM2>my value</MYITEM2></MYITEM2>"

in myXML

Resolution:

To preserve the case of data names when XML tags are generated with XML GENERATE it is necessary to use the PRESERVECASE compiler directive, i.e.

      $SET PRESERVECASE

This directive is not documented in Server Express 5.0 but should be documented in Server Express 5.1.

After setting PRESERVECASE, the contents of myXML in the example above would be:

"<myItem1><myItem2>my value</myItem1></myItem2>

Old KB# 2158